macro_rules! __phantom_struct {
(
$(#[$meta:meta])*
$vis:vis
$Name:ident
[]
[]
) => { ... };
(
$(#[$meta:meta])*
$vis:vis
$Name:ident
[$($lt:lifetime),+ $(,)?]
[]
) => { ... };
(
$(#[$meta:meta])*
$vis:vis
$Name:ident
[]
[$($gen:ident),+ $(,)?]
) => { ... };
(
$(#[$meta:meta])*
$vis:vis
$Name:ident
[$($lt:lifetime),+ $(,)?]
[$($gen:ident),+ $(,)?]
) => { ... };
}Expand description
Generates a zero-sized or PhantomData-backed marker struct.
This is an internal helper used by plugin_context, define_family,
and other macros that need to produce marker structs which may carry
lifetime or type parameters purely at the type level without any
runtime storage.
§Syntax
ⓘ
__phantom_struct!(
#[attributes] // optional
VISIBILITY // pub, pub(crate), or empty
NAME // struct identifier
[LIFETIMES] // e.g. ['a, 'b] or []
[GENERICS] // e.g. [T, U] or []
)§Variants
| Lifetimes | Generics | Generated struct |
|---|---|---|
[] | [] | struct Foo; |
['a] | [] | struct Foo<'a>(PhantomData<(&'a (),)>) |
[] | [T] | struct Foo<T>(PhantomData<(T,)>) |
['a] | [T] | struct Foo<'a, T>(PhantomData<(T, &'a ())>) |