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 @@ -2633,7 +2633,7 @@ comma:
26332633
26342634There are several forms of struct expressions. A _ struct expression_
26352635consists of the [ path] ( #paths ) of a [ struct item] ( #structs ) , followed by
2636- a brace-enclosed list of one or more comma-separated name-value pairs,
2636+ a brace-enclosed list of zero or more comma-separated name-value pairs,
26372637providing the field values of a new instance of the struct. A field name
26382638can be any identifier, and is separated from its value expression by a colon.
26392639The location denoted by a struct field is mutable if and only if the
@@ -2652,10 +2652,12 @@ The following are examples of struct expressions:
26522652
26532653```
26542654# struct Point { x: f64, y: f64 }
2655+ # struct NothingInMe { }
26552656# struct TuplePoint(f64, f64);
26562657# mod game { pub struct User<'a> { pub name: &'a str, pub age: u32, pub score: usize } }
26572658# struct Cookie; fn some_fn<T>(t: T) {}
26582659Point {x: 10.0, y: 20.0};
2660+ NothingInMe {};
26592661TuplePoint(10.0, 20.0);
26602662let u = game::User {name: "Joe", age: 35, score: 100_000};
26612663some_fn::<Cookie>(Cookie);
You can’t perform that action at this time.
0 commit comments