You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, I also prefer precision and explicitness, so I wouldn't recommend always supporting Into on every new param. Here are some brainstorms about design:
A per-struct style configuration
The default style equivalent to the current direct/concrete argument types, then a style called "Into" is introduced:
#[derive(new)]structAccount{#[new(style="Into")]name:String,info:Box<Address>,}let acct = Account::new("alice",Address::new(…));// Error: expected `Box<Address>` found `Address`
My preference is to support both struct-scoped and per-field configurations. Struct-scoped reduces boilerplate, whereas per-field allows fined-grained precision.
Many times I have MyStruct::new("something".into()). I would rather not keep typing into(). Perhaps there is a way that new can take an Into.
The text was updated successfully, but these errors were encountered: