Arust·RustbyApoplexy Tracking issue for RFC 3681: Default field values · Issue #132162 · rust-lang/rusthttps://github.com/rust-lang/rust/issues/132162Open linkView original on lemmy.world29Comments6
dd_k_bo feddit.org2Hide 2 repliesThis is really great and would solve the problem that led me to create constructor-lite. With this RFC, its usage could be replaced with #[derive(Debug, PartialEq)] struct Movie { title: String, year: Option<u16> = None, } assert_eq!( Movie { title: "Star Wars".to_owned(), .. }, Movie { title: "Star Wars".to_owned(), year: None }, ) 4
SorteKanin replyfeddit.dk1Hide 1 replyThink you would need Movie { title: "Star Wars".to_owned(), .. }, the .. is mandatory.2
It's really nice to see this RFC progress
I think this would be a nice improvement to reduce boiler plate.
Hmmm... I guess I don't see why not?
This is really great and would solve the problem that led me to create constructor-lite.
With this RFC, its usage could be replaced with
Think you would need
Movie { title: "Star Wars".to_owned(), .. }, the..is mandatory.Thanks, that was an oversight on my part.