pub struct Column<T> { /* private fields */ }Expand description
The storage of one component type: entity -> value, ordered by entity. Each value is a shared handle: a clone of the
column (of the world) shares every value with it, and writing a value that is shared copies it first, so neither side
sees the other’s writes (Column::get_shared).
Implementations§
Source§impl<T> Column<T>
impl<T> Column<T>
pub fn get(&self, e: Entity) -> Option<&T>
e’s value as a shared handle: the column’s own, not a copy. A later write through the column copies the value
first, so the handle keeps what it was given.
pub fn contains(&self, e: Entity) -> bool
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn iter(
&self,
) -> impl DoubleEndedIterator<Item = (Entity, &T)> + ExactSizeIterator
pub fn iter( &self, ) -> impl DoubleEndedIterator<Item = (Entity, &T)> + ExactSizeIterator
Entities and values in ascending entity order.
pub fn entities( &self, ) -> impl DoubleEndedIterator<Item = Entity> + ExactSizeIterator + '_
Source§impl<T: Clone> Column<T>
impl<T: Clone> Column<T>
Sourcepub fn get_mut(&mut self, e: Entity) -> Option<&mut T>
pub fn get_mut(&mut self, e: Entity) -> Option<&mut T>
e’s value to write: a value another clone of the column still shares is copied first.
Sourcepub fn iter_mut(
&mut self,
) -> impl DoubleEndedIterator<Item = (Entity, &mut T)> + ExactSizeIterator
pub fn iter_mut( &mut self, ) -> impl DoubleEndedIterator<Item = (Entity, &mut T)> + ExactSizeIterator
Every value to write, in ascending entity order: each one still shared is copied first.
Trait Implementations§
Auto Trait Implementations§
impl<T> Forget for Column<T>
impl<T> Freeze for Column<T>
impl<T> RefUnwindSafe for Column<T>
impl<T> Send for Column<T>
impl<T> Sync for Column<T>
impl<T> Unpin for Column<T>
impl<T> UnsafeUnpin for Column<T>
impl<T> UnwindSafe for Column<T>
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