Struct specs::Storage [] [src]

pub struct Storage<T, A, D> {
    // some fields omitted
}

A wrapper around the masked storage and the generations vector. Can be used for safe lookup of components, insertions and removes. This is what World::read/write locks for the user.

Methods

impl<T, A, D> Storage<T, A, D>
[src]

fn new(alloc: A, data: D) -> Storage<T, A, D>

Create a new Storage

impl<T, A, D> Storage<T, A, D> where T: Component, A: Deref<Target=Allocator>, D: Deref<Target=MaskedStorage<T>>
[src]

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

Tries to read the data associated with an Entity.

impl<T, A, D> Storage<T, A, D> where T: Component, A: Deref<Target=Allocator>, D: DerefMut<Target=MaskedStorage<T>>
[src]

fn get_mut(&mut self, e: Entity) -> Option<&mut T>

Tries to mutate the data associated with an Entity.

fn insert(&mut self, e: Entity, v: T) -> InsertResult<T>

Inserts new data for a given Entity. Returns the result of the operation as a InsertResult<T>

fn remove(&mut self, e: Entity) -> Option<T>

Removes the data associated with an Entity.

fn clear(&mut self)

Clears the contents of the storage.

Trait Implementations

impl<'a, T, A, D> Not for &'a Storage<T, A, D> where T: Component, D: Deref<Target=MaskedStorage<T>>
[src]

type Output = AntiStorage<'a>

The resulting type after applying the ! operator

fn not(self) -> Self::Output

The method for the unary ! operator

impl<'a, T, A, D> Join for &'a Storage<T, A, D> where T: Component, A: Deref<Target=Allocator>, D: Deref<Target=MaskedStorage<T>>
[src]

type Type = &'a T

Type of joined components.

type Value = &'a T::Storage

Type of joined storages.

type Mask = &'a BitSet

Type of joined bit mask.

fn open(self) -> (Self::Mask, Self::Value)

Open this join by returning the mask and the storages.

unsafe fn get(v: &mut Self::Value, i: Index) -> &'a T

Get a joined component value by a gien index.

fn iter(self) -> JoinIter<Self> where Self: Sized

Create a joined iterator over the contents.

impl<'a, T, A, D> Join for &'a mut Storage<T, A, D> where T: Component, A: Deref<Target=Allocator>, D: DerefMut<Target=MaskedStorage<T>>
[src]

type Type = &'a mut T

Type of joined components.

type Value = &'a mut T::Storage

Type of joined storages.

type Mask = &'a BitSet

Type of joined bit mask.

fn open(self) -> (Self::Mask, Self::Value)

Open this join by returning the mask and the storages.

unsafe fn get(v: &mut Self::Value, i: Index) -> &'a mut T

Get a joined component value by a gien index.

fn iter(self) -> JoinIter<Self> where Self: Sized

Create a joined iterator over the contents.