[−][src]Struct specs_static::Storage
A storage for components managed with specs_static::Id
instead of Entity
.
This Storage
behaves very similar to specs
' Storage
.
Registering
These component storages also have to be registered. This can be done using the WorldExt
trait and its register_tile_comp
method.
Methods
impl<C, D, I> Storage<C, D, I> where
C: Component,
D: UnprotectedStorage<C>,
I: Id,
[src]
C: Component,
D: UnprotectedStorage<C>,
I: Id,
pub fn get(&self, id: I) -> Option<&C>
[src]
Tries to retrieve a component by its Id
.
This will only check whether a component is inserted or not, without doing
any liveness checks for the id.
pub fn get_mut(&mut self, id: I) -> Option<&mut C>
[src]
Tries to retrieve a component mutably by its Id
.
This will only check whether a component is inserted or not, without doing
any liveness checks for the id.
pub fn insert(&mut self, id: I, comp: C) -> Option<C>
[src]
Inserts comp
at id
. If there already was a value, it will be returned.
In contrast to entities, there are no invalid ids.
pub fn remove(&mut self, id: I) -> Option<C>
[src]
Removes the component at id
.
Trait Implementations
impl<C, D, I> Drop for Storage<C, D, I> where
D: UnprotectedStorage<C>,
[src]
D: UnprotectedStorage<C>,
impl<C, D: UnprotectedStorage<C>, I> Default for Storage<C, D, I> where
D: Default,
[src]
D: Default,
impl<'a, C, D, I> Join for &'a Storage<C, D, I> where
D: UnprotectedStorage<C>,
[src]
D: UnprotectedStorage<C>,
type Type = &'a C
Type of joined components.
type Value = &'a D
Type of joined storages.
type Mask = &'a BitSet
Type of joined bit mask.
unsafe fn open(self) -> (Self::Mask, Self::Value)
[src]
unsafe fn get(value: &mut Self::Value, id: u32) -> Self::Type
[src]
fn join(self) -> JoinIter<Self>
[src]
Create a joined iterator over the contents.
fn maybe(self) -> MaybeJoin<Self>
[src]
Returns a Join
-able structure that yields all indices, returning None
for all missing elements and Some(T)
for found elements. Read more
fn is_unconstrained() -> bool
[src]
If this Join
typically returns all indices in the mask, then iterating over only it or combined with other joins that are also dangerous will cause the JoinIter
/ParJoin
to go through all indices which is usually not what is wanted and will kill performance. Read more
impl<'a, C, D, I> Join for &'a mut Storage<C, D, I> where
D: UnprotectedStorage<C>,
[src]
D: UnprotectedStorage<C>,
type Type = &'a mut C
Type of joined components.
type Value = &'a mut D
Type of joined storages.
type Mask = &'a BitSet
Type of joined bit mask.
unsafe fn open(self) -> (Self::Mask, Self::Value)
[src]
unsafe fn get(value: &mut Self::Value, id: u32) -> Self::Type
[src]
fn join(self) -> JoinIter<Self>
[src]
Create a joined iterator over the contents.
fn maybe(self) -> MaybeJoin<Self>
[src]
Returns a Join
-able structure that yields all indices, returning None
for all missing elements and Some(T)
for found elements. Read more
fn is_unconstrained() -> bool
[src]
If this Join
typically returns all indices in the mask, then iterating over only it or combined with other joins that are also dangerous will cause the JoinIter
/ParJoin
to go through all indices which is usually not what is wanted and will kill performance. Read more
impl<C, D, I> Tracked for Storage<C, D, I> where
D: Tracked + UnprotectedStorage<C>,
C: Component,
[src]
D: Tracked + UnprotectedStorage<C>,
C: Component,
fn channel(&self) -> &EventChannel<ComponentEvent>
[src]
fn channel_mut(&mut self) -> &mut EventChannel<ComponentEvent>
[src]
Auto Trait Implementations
impl<C, D, I> Send for Storage<C, D, I> where
C: Send,
D: Send,
I: Send,
C: Send,
D: Send,
I: Send,
impl<C, D, I> Sync for Storage<C, D, I> where
C: Sync,
D: Sync,
I: Sync,
C: Sync,
D: Sync,
I: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Resource for T where
T: Any + Send + Sync,
[src]
T: Any + Send + Sync,
impl<T> Any for T where
T: Any,
T: Any,
fn get_type_id(&self) -> TypeId
impl<T> TryDefault for T where
T: Default,
[src]
T: Default,
fn try_default() -> Result<T, String>
[src]
fn unwrap_default() -> Self
[src]
Calls try_default
and panics on an error case.
impl<T> Event for T where
T: Send + Sync + 'static,
[src]
T: Send + Sync + 'static,