Open Lucretiel opened 1 year ago
While I see that derive-new can create a collection of constructors for enum variants, it would be convenient for enums that always have a single new constructor, like this:
derive-new
new
#[derive(new)] enum Foo { #[new] InitialState { data: String }, SecondState{ data: Vec<u8> } } // Produces: fn new(data: String) -> Foo { Foo::InitialState{data}}
While I see that
derive-new
can create a collection of constructors for enum variants, it would be convenient for enums that always have a singlenew
constructor, like this: