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