-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
T-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.
Description
strawman syntax:
struct Foo {
a: String,
b: i32 = 42,
}
To instantiate:
let f = Foo { a: "Hello".to_owned() }; // b gets default value of 42
let f = Foo { a: "Hello".to_owned(), .. }; // alternative syntax to make default use explicit
let f = Foo { a: "Hello".to_owned(), b: 51 }; // b is 'overridden'
cc https://internals.rust-lang.org/t/struct-field-defaults/3412
solson, vaartis, CvX, k-jackson, kindlychung and 39 more
Metadata
Metadata
Assignees
Labels
T-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.