[][src]Macro components_arena::ComponentId

macro_rules! ComponentId {
    (
        ()
        $vis:vis struct $name:ident
        $(< $( $lt:tt $( : $clt:tt $(+ $dlt:tt )* )? ),+ $(,)?>)?
        ($id:ty $(, $($phantom:ty),+ $(,)?)?);
    ) => { ... };
    (
        @impl ($vis:vis) $name:ident [$($g:tt)*] [$($r:tt)*]
        [$($p:tt)*]
        [$phantom:ty $(, $($other_phantoms:tt)+)?]
    ) => { ... };
    (
        @impl ($vis:vis) $name:ident [$($g:tt)*] [$($r:tt)*]
        [$($p:tt)*] []
    ) => { ... };
}

Macro attribute for deriving ComponentId trait.

Examples

use std::marker::PhantomData;
use components_arena::{Component, Id, ComponentId};

macro_attr! {
    #[derive(ComponentId!)]
    #[derive(Educe)]
    #[educe(Debug, Copy, Clone, Eq, PartialEq, Hash, Ord, PartialOrd)]
    pub struct Item<Tag, X>(Id<ItemNode<Tag>>, PhantomData<X>);
}