Tracking issue for RFC 3681: Default field values · Issue #132162 · rust-lang/rust
Tracking issue for RFC 3681: Default field values · Issue #132162 · rust-lang/rust
github.com Tracking issue for RFC 3681: Default field values · Issue #132162 · rust-lang/rust
This is a tracking issue for the RFC "3681" (rust-lang/rfcs#3681). The feature gate for the issue is #![feature(default_field_values)]. Allow struct definitions to provide default values for indivi...
You're viewing a single thread.
All Comments
6 comments
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 }, )
4 0 ReplyThink you would need
Movie { title: "Star Wars".to_owned(), .. }
, the..
is mandatory.2 0 ReplyThanks, that was an oversight on my part.
2 0 Reply
6 comments
Scroll to top