Struct kaige::storage::ArchetypeWriter
source · pub struct ArchetypeWriter<'a> { /* private fields */ }Expand description
Provides access to writers for writing new entities into an archetype in a world.
Users must claim all components contained in the archetype and write an equal number of components to each as the number of entities pushed to the writer.
Implementations§
source§impl<'a> ArchetypeWriter<'a>
impl<'a> ArchetypeWriter<'a>
sourcepub fn new(
arch_index: ArchetypeIndex,
archetype: &'a mut Archetype,
components: MultiMut<'a>
) -> ArchetypeWriter<'a>
pub fn new( arch_index: ArchetypeIndex, archetype: &'a mut Archetype, components: MultiMut<'a> ) -> ArchetypeWriter<'a>
Constructs a new archetype writer.
sourcepub fn claim_components<T>(&mut self) -> ComponentWriter<'a, T>where
T: Component,
pub fn claim_components<T>(&mut self) -> ComponentWriter<'a, T>where
T: Component,
Claims a component storage for a given component.
Panics
Panics if the storage for the requested component type has already been claimed or does not exist in the archetype.
sourcepub fn claim_components_unknown(
&mut self,
type_id: ComponentTypeId
) -> UnknownComponentWriter<'a>
pub fn claim_components_unknown( &mut self, type_id: ComponentTypeId ) -> UnknownComponentWriter<'a>
Claims a component storage for a given component.
Panics
Panics if the storage for the requested component type has already been claimed or does not exist in the archetype.
sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional extra entity IDs in the archetype.
sourcepub fn inserted(&self) -> (ComponentIndex, &[Entity])
pub fn inserted(&self) -> (ComponentIndex, &[Entity])
Returns a slice of entities inserted by this writer, and the component index of the first inserted entity.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ArchetypeWriter<'a>
impl<'a> Send for ArchetypeWriter<'a>
impl<'a> Sync for ArchetypeWriter<'a>
impl<'a> Unpin for ArchetypeWriter<'a>
impl<'a> !UnwindSafe for ArchetypeWriter<'a>
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
source§impl<T> Component for T
impl<T> Component for T
§type Storage = PackedStorage<T>
type Storage = PackedStorage<T>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.