@@ -89,7 +89,8 @@ let c3 = Color{1: 0, ..c2}; // Fill out all other fields using a base struct.
8989
9090When initializing a data structure (struct, enum, union) with named (but not
9191numbered) fields, it is allowed to write ` fieldname ` as a shorthand for
92- ` fieldname: fieldname ` . This allows a compact syntax with less duplication. Example:
92+ ` fieldname: fieldname ` . This allows a compact syntax with less duplication.
93+ For example:
9394
9495``` rust
9596# struct Point3d { x : i32 , y : i32 , z : i32 }
@@ -104,7 +105,7 @@ Point3d { x, y: y_value, z };
104105
105106A struct expression with fields enclosed in parentheses constructs a tuple struct. Though
106107it is listed here as a specific expression for completeness, it is equivalent to a [ call
107- expression] to the tuple struct's constructor. Example :
108+ expression] to the tuple struct's constructor. For example :
108109
109110``` rust
110111struct Position (i32 , i32 , i32 );
@@ -117,7 +118,7 @@ let pos = c(8, 6, 7); // Creates a `Position` value.
117118
118119A unit struct expression is just the path to a unit struct item. This refers to the unit
119120struct's implicit constant of its value. The unit struct value can also be constructed
120- with fieldless struct expression. Example :
121+ with a fieldless struct expression. For example :
121122
122123``` rust
123124struct Gamma ;
0 commit comments