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...
6 comments
It's really nice to see this RFC progress
5 0 ReplyI think this would be a nice improvement to reduce boiler plate.
5 0 ReplyHmmm... I guess I don't see why not?
4 0 ReplyThis 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