Skip to main content

Column

Struct Column 

Source
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>

Source

pub fn get(&self, e: Entity) -> Option<&T>

Source

pub fn get_shared(&self, e: Entity) -> Option<Arc<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.

Source

pub fn contains(&self, e: Entity) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn iter( &self, ) -> impl DoubleEndedIterator<Item = (Entity, &T)> + ExactSizeIterator

Entities and values in ascending entity order.

Source

pub fn entities( &self, ) -> impl DoubleEndedIterator<Item = Entity> + ExactSizeIterator + '_

Source§

impl<T: Clone> Column<T>

Source

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.

Source

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§

Source§

impl<T: Clone> Clone for Column<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Column<T>

Source§

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

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

impl<T> Default for Column<T>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<T> Forget for Column<T>

§

impl<T> Freeze for Column<T>
where BTreeMap<Entity, Arc<T>>: Freeze,

§

impl<T> RefUnwindSafe for Column<T>

§

impl<T> Send for Column<T>
where BTreeMap<Entity, Arc<T>>: Send,

§

impl<T> Sync for Column<T>
where BTreeMap<Entity, Arc<T>>: Sync,

§

impl<T> Unpin for Column<T>
where BTreeMap<Entity, Arc<T>>: Unpin,

§

impl<T> UnsafeUnpin for Column<T>

§

impl<T> UnwindSafe for Column<T>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.