File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -2553,7 +2553,7 @@ comma:
25532553
25542554There are several forms of struct expressions. A _ struct expression_
25552555consists of the [ path] ( #paths ) of a [ struct item] ( #structs ) , followed by
2556- a brace-enclosed list of one or more comma-separated name-value pairs,
2556+ a brace-enclosed list of zero or more comma-separated name-value pairs,
25572557providing the field values of a new instance of the struct. A field name
25582558can be any identifier, and is separated from its value expression by a colon.
25592559The location denoted by a struct field is mutable if and only if the
@@ -2572,10 +2572,12 @@ The following are examples of struct expressions:
25722572
25732573```
25742574# struct Point { x: f64, y: f64 }
2575+ # struct NothingInMe { }
25752576# struct TuplePoint(f64, f64);
25762577# mod game { pub struct User<'a> { pub name: &'a str, pub age: u32, pub score: usize } }
25772578# struct Cookie; fn some_fn<T>(t: T) {}
25782579Point {x: 10.0, y: 20.0};
2580+ NothingInMe {};
25792581TuplePoint(10.0, 20.0);
25802582let u = game::User {name: "Joe", age: 35, score: 100_000};
25812583some_fn::<Cookie>(Cookie);
You can’t perform that action at this time.
0 commit comments