#[phantom]Expand description
Provides an automatic PhantomData field for a struct based on its generic types.
This macro simplifies the addition of a PhantomData field to a struct
to indicate that the struct logically owns instances of the generic types,
even though it does not store them.
ยงExample Usage
Instead of manually adding PhantomData<T> to MyStruct:
use std::marker::PhantomData;
pub struct MyStruct<T>
{
data: i32,
_phantom: PhantomData<T>,
}Use #[ phantom ] to automatically generate the PhantomData field:
use derive_tools_meta::*;
#[ phantom ]
pub struct MyStruct< T >
{
data: i32,
}The macro facilitates the addition of the PhantomData field without additional boilerplate code.