I can't wait to see how people use default field values in #Rust!
It felt like an eternity to land this (specially if we count the years of discussion before the, I believe, 3rd RFC was accepted), but as of next nightly you will be able to write
struct Foo {
bar: Type = Type::const_method(),
}
Foo { .. } // implicit bar: Type::const_method()
call
The main difference between https://github.com/rust-lang/rust/pull/129514 and derive(Default) is that the latter doesn't support having mandatory fields.
[#]RustLang
=> More informations about this toot | More toots from ekuber@hachyderm.io
Default fields values are now live on nightly #Rust! Go wild and report bugs 😃
[#]RustLang
=> View attached media | View attached media
=> More informations about this toot | More toots from ekuber@hachyderm.io
@ekuber looks nice but isn't this just less boilerplate?
=> More informations about this toot | More toots from psyhackological@fosstodon.org
@psyhackological isn't it all? Who needs for when you have while? Who needs if let when you have match?
=> More informations about this toot | More toots from ekuber@hachyderm.io
@ekuber hmm true...
=> More informations about this toot | More toots from psyhackological@fosstodon.org This content has been proxied by September (3851b).Proxy Information
text/gemini