Struct components_arena::ComponentClassToken [−][src]
pub struct ComponentClassToken<C: ComponentClass> { /* fields omitted */ }
Expand description
Component class static shared data.
In the no-no_std
environment it can be stored inside static
ComponentClassMutex
:
macro_attr! { #[derive(Component!)] struct MyComponent { /* ... */ } } static MY_COMPONENT: ComponentClassMutex<MyComponent> = ComponentClassMutex::new(); // ... let mut arena = Arena::new(&mut MY_COMPONENT.lock().unwrap()); let id = arena.insert(|id| (MyComponent { /* ... */ }, id));
In the no_std
environment a custom solution should be used to store ComponentClassToken
.
Implementations
Creates components shared data storage on first call for every component type C
.
All subsequent calls will return None
.
Trait Implementations
Auto Trait Implementations
impl<C> RefUnwindSafe for ComponentClassToken<C>
impl<C> Send for ComponentClassToken<C>
impl<C> Sync for ComponentClassToken<C>
impl<C> Unpin for ComponentClassToken<C>
impl<C> UnwindSafe for ComponentClassToken<C>