Closed xFrednet closed 2 months ago
I'm working on a project, that requires types to be transformed into an internal representation. Usually, this is done by calling .into() on the type. It would be awesome if the generated macro would support impl Into<FieldTy> parameters.
.into()
impl Into<FieldTy>
I imagine something like this:
#[derive(new)] struct Foo { #[new(into)] x: u32, }
which would generate:
impl Foo { fn new(x: impl Into<u32>) { Foo { x: x.into(), } } }
I implemented the feature in #65 (first time contributor to this crate). Please let me know what you think.
@nrc this issue can be closed since the #65 PR was merged?
Thank you for the implementation!
I'm working on a project, that requires types to be transformed into an internal representation. Usually, this is done by calling
.into()
on the type. It would be awesome if the generated macro would supportimpl Into<FieldTy>
parameters.I imagine something like this:
which would generate: