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 layoutUsers 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.Source§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 Freeze for SoaStorage
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> 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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§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.Source§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.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more