Macro components_arena::ComponentId [−][src]
macro_rules! ComponentId { ( () $vis:vis struct $name:ident $($body:tt)* ) => { ... }; ( @struct [$vis:vis] [$name:ident] [$($g:tt)*] [$($r:tt)*] [$($w:tt)*] ($id:ty $(, $($phantom:ty),+ $(,)?)?); ) => { ... }; ( @struct [$vis:vis] [$name:ident] [$($g:tt)*] [$($r:tt)*] [$($w:tt)*] $($body:tt)* ) => { ... }; ( @impl [$vis:vis] [$name:ident] [$($g:tt)*] [$($r:tt)*] [$($w:tt)*] [$($phantom_args:tt)*] [$phantom:ty $(, $($other_phantoms:tt)+)?] ) => { ... }; ( @impl [$vis:vis] [$name:ident] [$($g:tt)*] [$($r:tt)*] [$($w:tt)*] [$($phantom_args:tt)*] [] ) => { ... }; }
Expand description
Macro attribute for deriving ComponentId
trait.
Examples
use components_arena::{Component, Id, ComponentId}; use phantom_type::PhantomType; macro_attr! { #[derive(ComponentId!)] #[derive(Educe)] #[educe(Debug, Copy, Clone, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct Item<Tag, X>(Id<ItemNode<Tag>>, PhantomType<X>); }