I wish there was an easier way in Rust to implement Default on a type by supplying an exemplar const value without having to like do the whole multiline impl fn dance
@mcc There is an incoming feature, IIRC, for default field values in structs, that should reduce the copypaste, at least, but yeah. Seems like something that would have had a more ergonomic approach a while ago.
@mcc The language feature was approved with https://github.com/rust-lang/rfcs/pull/3681, and documents that yeah, #[derive(Default)] will work if every field has a default value or itself implements Default.
From the RFC:
``` #[derive(Default)] struct Pet { name: Option<String>, // impl Default for Pet will use Default::default() for name age: i128 = 42, // impl Default for Pet will use the literal 42 for age } ```