Struct legion::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
sourceimpl<'a> ArchetypeWriter<'a>
impl<'a> ArchetypeWriter<'a>
sourcepub fn new(
arch_index: ArchetypeIndex,
archetype: &'a mut Archetype,
components: MultiMut<'a>
) -> Self
pub fn new(
arch_index: ArchetypeIndex,
archetype: &'a mut Archetype,
components: MultiMut<'a>
) -> Self
Constructs a new archetype writer.
sourcepub fn claim_components<T: Component>(&mut self) -> ComponentWriter<'a, T>
pub fn claim_components<T: Component>(&mut self) -> ComponentWriter<'a, T>
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.
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcepub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
pub 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 more
sourcepub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub 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 more
sourcepub fn as_any(&self) -> &(dyn Any + 'static)
pub 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 more
sourcepub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub 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