File tree 1 file changed +3
-1
lines changed
1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -2633,7 +2633,7 @@ comma:
2633
2633
2634
2634
There are several forms of struct expressions. A _ struct expression_
2635
2635
consists 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,
2637
2637
providing the field values of a new instance of the struct. A field name
2638
2638
can be any identifier, and is separated from its value expression by a colon.
2639
2639
The location denoted by a struct field is mutable if and only if the
@@ -2652,10 +2652,12 @@ The following are examples of struct expressions:
2652
2652
2653
2653
```
2654
2654
# struct Point { x: f64, y: f64 }
2655
+ # struct NothingInMe { }
2655
2656
# struct TuplePoint(f64, f64);
2656
2657
# mod game { pub struct User<'a> { pub name: &'a str, pub age: u32, pub score: usize } }
2657
2658
# struct Cookie; fn some_fn<T>(t: T) {}
2658
2659
Point {x: 10.0, y: 20.0};
2660
+ NothingInMe {};
2659
2661
TuplePoint(10.0, 20.0);
2660
2662
let u = game::User {name: "Joe", age: 35, score: 100_000};
2661
2663
some_fn::<Cookie>(Cookie);
You can’t perform that action at this time.
0 commit comments