Trait pyro::Storage

source ·
pub trait Storage: Sized {
    fn len(&self) -> usize;
    fn len_mut(&mut self) -> &mut usize;
    fn id(&self) -> StorageId;
    fn empty(id: StorageId) -> EmptyStorage<Self>;
    unsafe fn component<C: Component>(&self) -> &[C] ;
    unsafe fn component_mut<C: Component>(&self) -> &mut [C] ;
    fn push_components<C, I>(&mut self, components: I)
    where
        C: Component,
        I: IntoIterator<Item = C>
; fn push_component<C: Component>(&mut self, component: C); fn contains<C: Component>(&self) -> bool; fn types(&self) -> &HashSet<TypeId>; fn remove(&mut self, id: ComponentId) -> usize; }
Expand description

Storage allows to abstract over different types of storages. The most common storage that implements this trait is SoaStorage.

Required Methods§

Creates an EmptyStorage. This storage will not have any registered components when it is created. See RegisterComponent.

Retrieves the component array and panics if C is not inside this storage.

Same as Storage::component but mutable.

Appends components to one array. See AppendComponents that uses this method.

Returns true if the Storage has an array of type C.

Removes all the components at the specified index.

Implementors§