to_phantom
Easily convert Generics
to PhantomData
in your proc macros.
This is useful for when creating custom types in a proc macro that use the generics from some other type.
The PhantomData
allows those generics to exist on the type without needing dedicated fields using them.
```rust use to_phantom::ToPhantom;
fn createhelper(input: DeriveInput) -> TokenStream { let generics = input.generics(); let phantom = generics.tophantom();
quote! {
pub struct MyHelperStruct #generics {
phantom: #phantom,
}
}
} ```