by DemocracyFTW2 · 2y ago · 0 comments
It would have to look something like:
f({ hours: 2, seconds: 53, ..Default::default() })
The defaults could come from some value / function with a name shorter than Default::default(), but it would be less clear.- leaving some mandatory fields
- reduce the need for the builder pattern
- enable the above to be written as f(S { hours: 2, seconds: 53, .. })
If that feature ever lands, coupled with structural/anonymous structs or struct literal inference, you're getting everything you'd want from named arguments without any of the foot guns.
It got postponed because it wasn't going to make it into Rust 2018: https://github.com/rust-lang/rfcs/pull/1806#issuecomment-327...