@@ -1076,7 +1076,7 @@ let p: Point = (41, 68);
1076
1076
1077
1077
### Structs
1078
1078
1079
- A _ structure _ is a nominal [ structure type] ( #structure -types ) defined with the
1079
+ A _ struct _ is a nominal [ struct type] ( #struct -types ) defined with the
1080
1080
keyword ` struct ` .
1081
1081
1082
1082
An example of a ` struct ` item and its use:
@@ -1087,7 +1087,7 @@ let p = Point {x: 10, y: 11};
1087
1087
let px: i32 = p.x;
1088
1088
```
1089
1089
1090
- A _ tuple structure _ is a nominal [ tuple type] ( #tuple-types ) , also defined with
1090
+ A _ tuple struct _ is a nominal [ tuple type] ( #tuple-types ) , also defined with
1091
1091
the keyword ` struct ` . For example:
1092
1092
1093
1093
```
@@ -1096,8 +1096,8 @@ let p = Point(10, 11);
1096
1096
let px: i32 = match p { Point(x, _) => x };
1097
1097
```
1098
1098
1099
- A _ unit-like struct_ is a structure without any fields, defined by leaving off
1100
- the list of fields entirely. Such a structure implicitly defines a constant of
1099
+ A _ unit-like struct_ is a struct without any fields, defined by leaving off
1100
+ the list of fields entirely. Such a struct implicitly defines a constant of
1101
1101
its type with the same name. For example:
1102
1102
1103
1103
```
@@ -1115,7 +1115,7 @@ const Cookie: Cookie = Cookie {};
1115
1115
let c = [Cookie, Cookie {}, Cookie, Cookie {}];
1116
1116
```
1117
1117
1118
- The precise memory layout of a structure is not specified. One can specify a
1118
+ The precise memory layout of a struct is not specified. One can specify a
1119
1119
particular layout using the [ ` repr ` attribute] ( #ffi-attributes ) .
1120
1120
1121
1121
### Enumerations
@@ -2404,7 +2404,7 @@ items.
2404
2404
2405
2405
An _ item declaration statement_ has a syntactic form identical to an
2406
2406
[ item] ( #items ) declaration within a module. Declaring an item &mdash ; a
2407
- function, enumeration, structure , type, static, trait, implementation or module
2407
+ function, enumeration, struct , type, static, trait, implementation or module
2408
2408
&mdash ; locally within a statement block is simply a way of restricting its
2409
2409
scope to a narrow region containing all of its uses; it is otherwise identical
2410
2410
in meaning to declaring the item outside the statement block.
@@ -2549,26 +2549,26 @@ comma:
2549
2549
(0); // zero in parentheses
2550
2550
```
2551
2551
2552
- ### Structure expressions
2552
+ ### Struct expressions
2553
2553
2554
- There are several forms of structure expressions. A _ structure expression_
2555
- consists of the [ path] ( #paths ) of a [ structure item] ( #structs ) , followed by
2554
+ There are several forms of struct expressions. A _ struct expression_
2555
+ consists of the [ path] ( #paths ) of a [ struct item] ( #structs ) , followed by
2556
2556
a brace-enclosed list of one or more comma-separated name-value pairs,
2557
- providing the field values of a new instance of the structure . A field name
2557
+ providing the field values of a new instance of the struct . A field name
2558
2558
can be any identifier, and is separated from its value expression by a colon.
2559
- The location denoted by a structure field is mutable if and only if the
2560
- enclosing structure is mutable.
2559
+ The location denoted by a struct field is mutable if and only if the
2560
+ enclosing struct is mutable.
2561
2561
2562
- A _ tuple structure expression_ consists of the [ path] ( #paths ) of a [ structure
2562
+ A _ tuple struct expression_ consists of the [ path] ( #paths ) of a [ struct
2563
2563
item] ( #structs ) , followed by a parenthesized list of one or more
2564
- comma-separated expressions (in other words, the path of a structure item
2565
- followed by a tuple expression). The structure item must be a tuple structure
2564
+ comma-separated expressions (in other words, the path of a struct item
2565
+ followed by a tuple expression). The struct item must be a tuple struct
2566
2566
item.
2567
2567
2568
- A _ unit-like structure expression_ consists only of the [ path] ( #paths ) of a
2569
- [ structure item] ( #structs ) .
2568
+ A _ unit-like struct expression_ consists only of the [ path] ( #paths ) of a
2569
+ [ struct item] ( #structs ) .
2570
2570
2571
- The following are examples of structure expressions:
2571
+ The following are examples of struct expressions:
2572
2572
2573
2573
```
2574
2574
# struct Point { x: f64, y: f64 }
@@ -2581,14 +2581,14 @@ let u = game::User {name: "Joe", age: 35, score: 100_000};
2581
2581
some_fn::<Cookie>(Cookie);
2582
2582
```
2583
2583
2584
- A structure expression forms a new value of the named structure type. Note
2585
- that for a given * unit-like* structure type, this will always be the same
2584
+ A struct expression forms a new value of the named struct type. Note
2585
+ that for a given * unit-like* struct type, this will always be the same
2586
2586
value.
2587
2587
2588
- A structure expression can terminate with the syntax ` .. ` followed by an
2588
+ A struct expression can terminate with the syntax ` .. ` followed by an
2589
2589
expression to denote a functional update. The expression following ` .. ` (the
2590
- base) must have the same structure type as the new structure type being formed.
2591
- The entire expression denotes the result of constructing a new structure (with
2590
+ base) must have the same struct type as the new struct type being formed.
2591
+ The entire expression denotes the result of constructing a new struct (with
2592
2592
the same type as the base expression) with the given values for the fields that
2593
2593
were explicitly specified and the values in the base expression for all other
2594
2594
fields.
@@ -2634,7 +2634,7 @@ the left-hand-side expression is an indirect [trait object](#trait-objects).
2634
2634
A _ field expression_ consists of an expression followed by a single dot and an
2635
2635
identifier, when not immediately followed by a parenthesized expression-list
2636
2636
(the latter is a [ method call expression] ( #method-call-expressions ) ). A field
2637
- expression denotes a field of a [ structure ] ( #structure -types ) .
2637
+ expression denotes a field of a [ struct ] ( #struct -types ) .
2638
2638
2639
2639
``` {.ignore .field}
2640
2640
mystruct.myfield;
@@ -3353,17 +3353,17 @@ As you can see, the `vec!` macro allows you to create a `Vec<T>` easily. The
3353
3353
All in-bounds elements of arrays and slices are always initialized, and access
3354
3354
to an array or slice is always bounds-checked.
3355
3355
3356
- ### Structure types
3356
+ ### Struct types
3357
3357
3358
3358
A ` struct ` * type* is a heterogeneous product of other types, called the
3359
3359
* fields* of the type.[ ^ structtype ]
3360
3360
3361
3361
[ ^ structtype ] : ` struct ` types are analogous to ` struct ` types in C,
3362
3362
the * record* types of the ML family,
3363
- or the * structure * types of the Lisp family.
3363
+ or the * struct * types of the Lisp family.
3364
3364
3365
3365
New instances of a ` struct ` can be constructed with a [ struct
3366
- expression] ( #structure -expressions ) .
3366
+ expression] ( #struct -expressions ) .
3367
3367
3368
3368
The memory layout of a ` struct ` is undefined by default to allow for compiler
3369
3369
optimizations like field reordering, but it can be fixed with the
@@ -3373,14 +3373,14 @@ have the same memory layout.
3373
3373
3374
3374
The fields of a ` struct ` may be qualified by [ visibility
3375
3375
modifiers] ( #visibility-and-privacy ) , to allow access to data in a
3376
- structure outside a module.
3376
+ struct outside a module.
3377
3377
3378
- A _ tuple struct_ type is just like a structure type, except that the fields are
3378
+ A _ tuple struct_ type is just like a struct type, except that the fields are
3379
3379
anonymous.
3380
3380
3381
- A _ unit-like struct_ type is like a structure type, except that it has no
3382
- fields. The one value constructed by the associated [ structure
3383
- expression] ( #structure -expressions ) is the only value that inhabits such a
3381
+ A _ unit-like struct_ type is like a struct type, except that it has no
3382
+ fields. The one value constructed by the associated [ struct
3383
+ expression] ( #struct -expressions ) is the only value that inhabits such a
3384
3384
type.
3385
3385
3386
3386
### Enumerated types
@@ -3407,7 +3407,7 @@ named reference to an [`enum` item](#enumerations).
3407
3407
### Recursive types
3408
3408
3409
3409
Nominal types &mdash ; [ enumerations] ( #enumerated-types ) and
3410
- [ structs] ( #structure -types ) &mdash ; may be recursive. That is, each ` enum `
3410
+ [ structs] ( #struct -types ) &mdash ; may be recursive. That is, each ` enum `
3411
3411
constructor or ` struct ` field may refer, directly or indirectly, to the
3412
3412
enclosing ` enum ` or ` struct ` type itself. Such recursion has restrictions:
3413
3413
0 commit comments