@Apoplexy to [email protected]English • 5 days agoTracking issue for RFC 3681: Default field values · Issue #132162 · rust-lang/rustgithub.comexternal-linkmessage-square6arrow-up130arrow-down11
arrow-up129arrow-down1external-linkTracking issue for RFC 3681: Default field values · Issue #132162 · rust-lang/rustgithub.com@Apoplexy to [email protected]English • 5 days agomessage-square6
minus-square@[email protected]linkfedilink4•edit-22 days agoThis 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 }, )
minus-square@[email protected]linkfedilink2•2 days agoThink you would need Movie { title: "Star Wars".to_owned(), .. }, the .. is mandatory.
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
#[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 }, )
Think you would need
Movie { title: "Star Wars".to_owned(), .. }
, the..
is mandatory.Thanks, that was an oversight on my part.