DanielKeep / rust-custom-derive

Custom derivation macro for Rust
Other
110 stars 17 forks source link

newtype_derive for generic types #26

Open veldsla opened 7 years ago

veldsla commented 7 years ago

I tried to use a generic type in the with the custom_derive / newtype_derive macro, but that doesn't compile. See also rust-bio/rust-bio#101.

custom_derive! {
    #[derive(NewtypeFrom, NewtypeDeref, Debug, Clone)]
    pub struct Interval<N>(Range<N>);
}

Looking around I think the macro doesn't currently parse the type. If I look at the effort in rust-parse-generics it also seems quite complicated. Do you expect to support this in the (near) future, or should I manually do the newtype?