feat: added cleanscript
This commit is contained in:
21
ch05/ch05-00-structs.html
Normal file
21
ch05/ch05-00-structs.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Using Structs to Structure Related Data</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="using-structs-to-structure-related-data"><a class="header" href="#using-structs-to-structure-related-data">Using Structs to Structure Related Data</a></h1>
|
||||
<p>A <em>struct</em>, or <em>structure</em>, is a custom data type that lets you package
|
||||
together and name multiple related values that make up a meaningful group. If
|
||||
you’re familiar with an object-oriented language, a struct is like an object’s
|
||||
data attributes. In this chapter, we’ll compare and contrast tuples with
|
||||
structs to build on what you already know and demonstrate when structs are a
|
||||
better way to group data.</p>
|
||||
<p>We’ll demonstrate how to define and instantiate structs. We’ll discuss how to
|
||||
define associated functions, especially the kind of associated functions called
|
||||
<em>methods</em>, to specify behavior associated with a struct type. Structs and enums
|
||||
(discussed in Chapter 6) are the building blocks for creating new types in your
|
||||
program’s domain to take full advantage of Rust’s compile-time type checking.</p>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user