Struct DenseVecStorage

Source
pub struct DenseVecStorage<T> { /* private fields */ }
Expand description

Dense vector storage. Has a redirection 2-way table between entities and components, allowing to leave no gaps within the data.

Note that this only stores the data (T) densely; indices to the data are stored in a sparse Vec.

as_slice() and as_mut_slice() indices are local to this DenseVecStorage at this particular moment. These indices cannot be compared with indices from any other storage, and a particular entity’s position within this slice may change over time.

Trait Implementations§

Source§

impl<T> Default for DenseVecStorage<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> Storage<T> for DenseVecStorage<T>

Source§

unsafe fn get(&self, index: Index) -> &T

Tries reading the data associated with an Index. This is unsafe because the external set used to protect this storage is absent. Read more
Source§

unsafe fn get_mut(&mut self, index: Index) -> &mut T

Tries mutating the data associated with an Index. This is unsafe because the external set used to protect this storage is absent. Read more
Source§

unsafe fn insert(&mut self, index: Index, v: T)

Inserts new data for a given Index. Read more
Source§

unsafe fn remove(&mut self, index: Index) -> T

Removes the data associated with an Index. Read more
Source§

unsafe fn clean<B>(&mut self, _has: B)
where B: BitSetLike,

Clean the storage given a bitset with bits set for valid indices. Allows us to safely drop the storage. Read more
Source§

unsafe fn drop(&mut self, index: Index)

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. Read more
Source§

impl<T> DistinctStorage for DenseVecStorage<T>

Auto Trait Implementations§

§

impl<T> Freeze for DenseVecStorage<T>

§

impl<T> RefUnwindSafe for DenseVecStorage<T>
where T: RefUnwindSafe,

§

impl<T> Send for DenseVecStorage<T>
where T: Send,

§

impl<T> Sync for DenseVecStorage<T>
where T: Sync,

§

impl<T> Unpin for DenseVecStorage<T>
where T: Unpin,

§

impl<T> UnwindSafe for DenseVecStorage<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Any for T
where T: Any,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> TryDefault for T
where T: Default,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Resource for T
where T: Any + Send + Sync,