Struct specs::storage::HashMapStorage
source · pub struct HashMapStorage<T>(/* private fields */);
Expand description
HashMap
-based storage. Best suited for rare components.
This uses the std::collections::HashMap internally.
Trait Implementations§
source§impl<T> Default for HashMapStorage<T>
impl<T> Default for HashMapStorage<T>
Gets mutable access to the the data associated with an
Index
. Read moresource§impl<T> UnprotectedStorage<T> for HashMapStorage<T>
impl<T> UnprotectedStorage<T> for HashMapStorage<T>
§type AccessMut<'a> = &'a mut T
where
T: 'a
type AccessMut<'a> = &'a mut T where T: 'a
The wrapper through with mutable access of a component is performed.
source§unsafe fn clean<B>(&mut self, _has: B)where
B: BitSetLike,
unsafe fn clean<B>(&mut self, _has: B)where B: BitSetLike,
Clean the storage given a bitset with bits set for valid indices
dropping all existing components. Read more
source§unsafe fn get(&self, id: Index) -> &T
unsafe fn get(&self, id: Index) -> &T
Gets a shared reference to the data associated with an
Index
. Read moresource§unsafe fn get_mut(&mut self, id: Index) -> &mut T
unsafe fn get_mut(&mut self, id: Index) -> &mut T
Gets mutable access to the the data associated with an
Index
. Read moreimpl<T> DistinctStorage for HashMapStorage<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for HashMapStorage<T>
impl<T> Send for HashMapStorage<T>where T: Send,
impl<T> Sync for HashMapStorage<T>where T: Sync,
impl<T> Unpin for HashMapStorage<T>where T: Unpin,
impl<T> UnwindSafe for HashMapStorage<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> TryDefault for Twhere
T: Default,
impl<T> TryDefault for Twhere T: Default,
source§fn try_default() -> Result<T, String>
fn try_default() -> Result<T, String>
Tries to create the default.
source§fn unwrap_default() -> Self
fn unwrap_default() -> Self
Calls
try_default
and panics on an error case.