Struct BasicVecStorage

Source
pub struct BasicVecStorage<T>(/* private fields */);
Expand description

ComponentStorage that is just Vec<Option<T>>.

Trait Implementations§

Source§

impl<'a, T> ComponentStorage<'a> for BasicVecStorage<T>
where T: 'a,

Source§

type Component = T

The individual type of the Component in this storage
Source§

type Iter = Map<Iter<'a, Option<UnsafeCell<T>>>, fn(&'a Option<UnsafeCell<T>>) -> Option<&'a T>>

Immutable iterator type.
Source§

fn get<'b>(&'b self, entity: Entity) -> Option<&'b T>

Get the component corresponding to the given entity, if it exists.
Source§

fn get_raw(&self, entity: Entity) -> *const T

Get a raw pointer to the component corresponding to the given entity, if it exists. Must return std::ptr::null() if the component doesn’t exist for the given entity.
Source§

fn set(&mut self, entity: Entity, item: Option<T>)

Set the component for the given entity.
Source§

fn reserve(&mut self, n: usize)

Reserve n additional slots without affecting the size of the storage. The default implementation is a no-op; only implement if it makes sense for your storage type.
Source§

fn size(&self) -> usize

Get the number of components currently stored.
Source§

fn iter(&'a self) -> Self::Iter

Iterate over the components in this storage. Read more
Source§

impl<T: Debug> Debug for BasicVecStorage<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for BasicVecStorage<T>

Source§

fn default() -> BasicVecStorage<T>

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

impl<'a, T: 'a> MutableComponentStorage<'a> for BasicVecStorage<T>

Source§

type IterMut = Map<IterMut<'a, Option<UnsafeCell<T>>>, fn(&mut Option<UnsafeCell<T>>) -> Option<&'a mut T>>

Mutable iterator type.
Source§

fn iter_mut(&'a mut self) -> Self::IterMut

Mutably iterate over the components in this storage. Read more
Source§

fn get_mut<'b>(&'b mut self, entity: Entity) -> Option<&'b mut T>

Get a mutable reference to the component corresponding to the given entity, if it exists.
Source§

fn get_raw_mut(&mut self, entity: Entity) -> *mut T

Get a mutable raw pointer to the component corresponding to the given entity, if it exists. Must return std::ptr::null() if the component doesn’t exist for the given entity.

Auto Trait Implementations§

§

impl<T> Freeze for BasicVecStorage<T>

§

impl<T> !RefUnwindSafe for BasicVecStorage<T>

§

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

§

impl<T> !Sync for BasicVecStorage<T>

§

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

§

impl<T> UnwindSafe for BasicVecStorage<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> 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<'a, WD> ComponentProviderRec<'a, ()> for WD

Source§

fn fetch(&'a self)

Get the components.
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, 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.