Struct pyro::SoaStorage
source · pub struct SoaStorage { /* private fields */ }
Expand description
A runtime SoA storage. It stands for Structure of Arrays.
ⓘ
struct Test {
foo: Foo,
bar: Bar,
baz: Baz,
}
let test: Vec<Test> = ...; // Array of Structs (*AoS*) layout
struct Test {
foo: Vec<Foo>,
bar: Vec<Bar>,
baz: Vec<Baz>,
}
let test: Test = ...; // SoA layout
Users do not interact with this storage directly, instead World
will use this storage
behind the scenes. In the future there will be other storages such as AoSoA, which is a fancy
way of saying SoA but with arrays that a limited to a size of 8
.
Trait Implementations§
source§impl RegisterComponent for SoaStorage
impl RegisterComponent for SoaStorage
fn register_component<C: Component>(&mut self)
source§impl Storage for SoaStorage
impl Storage for SoaStorage
fn len(&self) -> usize
fn len_mut(&mut self) -> &mut usize
source§fn remove(&mut self, id: ComponentId) -> usize
fn remove(&mut self, id: ComponentId) -> usize
Removes all the components at the specified index.
fn id(&self) -> StorageId
source§fn push_components<C, I>(&mut self, components: I)where
C: Component,
I: IntoIterator<Item = C>,
fn push_components<C, I>(&mut self, components: I)where
C: Component,
I: IntoIterator<Item = C>,
Appends components to one array. See
AppendComponents
that uses this method.fn push_component<C: Component>(&mut self, component: C)
source§fn empty(id: StorageId) -> EmptyStorage<Self>
fn empty(id: StorageId) -> EmptyStorage<Self>
Creates an
EmptyStorage
. This storage will not have any registered components when it
is created. See RegisterComponent
. Read moresource§unsafe fn component_mut<C: Component>(&self) -> &mut [C] ⓘ
unsafe fn component_mut<C: Component>(&self) -> &mut [C] ⓘ
Same as
Storage::component
but mutable.source§unsafe fn component<C: Component>(&self) -> &[C] ⓘ
unsafe fn component<C: Component>(&self) -> &[C] ⓘ
Retrieves the component array and panics if
C
is not inside this storage.fn types(&self) -> &HashSet<TypeId>
Auto Trait Implementations§
impl !RefUnwindSafe for SoaStorage
impl !Send for SoaStorage
impl !Sync for SoaStorage
impl Unpin for SoaStorage
impl !UnwindSafe for SoaStorage
Blanket Implementations§
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read moresource§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read moresource§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read moresource§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more