pub struct Archetypes { /* private fields */ }Expand description
Contains all the Archetypes and their metadata for a world.
This can be obtained in a handler by using the &Archetypes handler
parameter.
world.add_handler(|_: Receiver<E>, archetypes: &Archetypes| {});Implementations§
Source§impl Archetypes
impl Archetypes
Sourcepub fn empty(&self) -> &Archetype
pub fn empty(&self) -> &Archetype
Returns a reference to the empty archetype (The archetype with no components).
The empty archetype is always present, so this function is infallible.
Sourcepub fn get(&self, idx: ArchetypeIdx) -> Option<&Archetype>
pub fn get(&self, idx: ArchetypeIdx) -> Option<&Archetype>
Gets a reference to the archetype identified by the given
ArchetypeIdx. Returns None if the index is invalid.
Sourcepub fn get_by_components(
&self,
components: &[ComponentIdx],
) -> Option<&Archetype>
pub fn get_by_components( &self, components: &[ComponentIdx], ) -> Option<&Archetype>
Gets a reference to the archetype with the given set of components.
Returns None if there is no archetype with the given set of
components or the given ComponentIdx slice is not sorted and
deduplicated.
Trait Implementations§
Source§impl Debug for Archetypes
impl Debug for Archetypes
Source§impl HandlerParam for &Archetypes
impl HandlerParam for &Archetypes
Source§type This<'a> = &'a Archetypes
type This<'a> = &'a Archetypes
The type produced by this handler param. This must be the type
of
Self but with the lifetime of 'a.Source§fn init(
_world: &mut World,
_config: &mut HandlerConfig,
) -> Result<Self::State, InitError>
fn init( _world: &mut World, _config: &mut HandlerConfig, ) -> Result<Self::State, InitError>
Source§unsafe fn get<'a>(
_state: &'a mut Self::State,
_info: &'a HandlerInfo,
_event_ptr: EventPtr<'a>,
_target_location: EntityLocation,
world: UnsafeWorldCell<'a>,
) -> Self::This<'a>
unsafe fn get<'a>( _state: &'a mut Self::State, _info: &'a HandlerInfo, _event_ptr: EventPtr<'a>, _target_location: EntityLocation, world: UnsafeWorldCell<'a>, ) -> Self::This<'a>
Obtains a new instance of the handler parameter. Read more
Source§fn refresh_archetype(_state: &mut Self::State, _arch: &Archetype)
fn refresh_archetype(_state: &mut Self::State, _arch: &Archetype)
Refresh an archetype for this handler param. Called whenever
Handler::refresh_archetype is called.Source§fn remove_archetype(_state: &mut Self::State, _arch: &Archetype)
fn remove_archetype(_state: &mut Self::State, _arch: &Archetype)
Remove the given archetype for this handler param. Called whenever
Handler::remove_archetype is called.Source§impl Index<ArchetypeIdx> for Archetypes
impl Index<ArchetypeIdx> for Archetypes
Auto Trait Implementations§
impl Freeze for Archetypes
impl RefUnwindSafe for Archetypes
impl Send for Archetypes
impl Sync for Archetypes
impl Unpin for Archetypes
impl UnwindSafe for Archetypes
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> 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