[−][src]Trait async_ecs::storage::Storage
Used by the framework to quickly join components.
Required methods
pub unsafe fn get(&self, index: Index) -> &T
[src]
Tries reading the data associated with an Index
.
This is unsafe because the external set used
to protect this storage is absent.
Safety
May only be called after a call to insert
with id
and
no following call to remove
with id
.
A mask should keep track of those states, and an id
being contained
in the tracking mask is sufficient to call this method.
pub unsafe fn get_mut(&mut self, index: Index) -> &mut T
[src]
Tries mutating the data associated with an Index
.
This is unsafe because the external set used
to protect this storage is absent.
Safety
May only be called after a call to insert
with id
and
no following call to remove
with id
.
A mask should keep track of those states, and an id
being contained
in the tracking mask is sufficient to call this method.
pub unsafe fn insert(&mut self, index: Index, value: T)
[src]
Inserts new data for a given Index
.
Safety
May only be called if insert
was not called with id
before, or
was reverted by a call to remove
with `id.
A mask should keep track of those states, and an id
missing from the
mask is sufficient to call insert
.
pub unsafe fn remove(&mut self, index: Index) -> T
[src]
Removes the data associated with an Index
.
Safety
May only be called if an element with id
was insert
ed and not yet
removed / dropped.
pub unsafe fn clean<B>(&mut self, has: B) where
B: BitSetLike,
[src]
B: BitSetLike,
Clean the storage given a bitset with bits set for valid indices. Allows us to safely drop the storage.
Safety
May only be called with the mask which keeps track of the elements existing in this storage.
Provided methods
pub unsafe fn drop(&mut self, index: Index)
[src]
Drops the data associated with an Index
.
This could be used when a more efficient implementation for it exists than remove
when the data
is no longer needed.
Defaults to simply calling remove
.
Safety
May only be called if an element with id
was insert
ed and not yet
removed / dropped.
Implementors
impl<T> Storage<T> for BTreeStorage<T>
[src]
pub unsafe fn get(&self, index: Index) -> &T
[src]
pub unsafe fn get_mut(&mut self, index: Index) -> &mut T
[src]
pub unsafe fn insert(&mut self, index: Index, value: T)
[src]
pub unsafe fn remove(&mut self, index: Index) -> T
[src]
pub unsafe fn clean<B>(&mut self, _has: B) where
B: BitSetLike,
[src]
B: BitSetLike,
impl<T> Storage<T> for DenseVecStorage<T>
[src]
pub unsafe fn get(&self, index: Index) -> &T
[src]
pub unsafe fn get_mut(&mut self, index: Index) -> &mut T
[src]
pub unsafe fn insert(&mut self, index: Index, v: T)
[src]
pub unsafe fn remove(&mut self, index: Index) -> T
[src]
pub unsafe fn clean<B>(&mut self, _has: B) where
B: BitSetLike,
[src]
B: BitSetLike,
impl<T> Storage<T> for HashMapStorage<T>
[src]
pub unsafe fn get(&self, id: Index) -> &T
[src]
pub unsafe fn get_mut(&mut self, id: Index) -> &mut T
[src]
pub unsafe fn insert(&mut self, id: Index, v: T)
[src]
pub unsafe fn remove(&mut self, index: Index) -> T
[src]
pub unsafe fn clean<B>(&mut self, _has: B) where
B: BitSetLike,
[src]
B: BitSetLike,