Ancestors

Written by Esteban Küber :rust: on 2024-12-10 at 16:21

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

=> View attached media

=> More informations about this toot | More toots from ekuber@hachyderm.io

Written by Jonas Platte on 2024-12-10 at 16:38

@ekuber #[non_exhaustive] compatibility when? 😛

=> More informations about this toot | More toots from jplatte@social.tchncs.de

Written by Esteban Küber :rust: on 2024-12-10 at 17:46

@jplatte Coming. Didn't want to try and land the whole thing in one go. That would be a nightmare to rebase and unfair for the reviewers.

=> More informations about this toot | More toots from ekuber@hachyderm.io

Toot

Written by Jonas Platte on 2024-12-10 at 18:41

@ekuber oh yeah, of course. I was 100% joking, did not expect it to be something you're already working on! :blobcataww:

=> More informations about this toot | More toots from jplatte@social.tchncs.de

Descendants

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113629992947967639
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
274.749415 milliseconds
Gemini-to-HTML Time
0.715907 milliseconds

This content has been proxied by September (3851b).