pub struct Components { /* private fields */ }
Expand description

Contains metadata for all the components in a world.

This can be obtained in a system by using the &Components system parameter.

world.add_system(|_: Receiver<E>, components: &Components| {});

Implementations§

source§

impl Components

source

pub fn get(&self, id: ComponentId) -> Option<&ComponentInfo>

Gets the ComponentInfo of the given component. Returns None if the ID is invalid.

source

pub fn get_by_index(&self, idx: ComponentIdx) -> Option<&ComponentInfo>

Gets the ComponentInfo for a component using its ComponentIdx. Returns None if the index is invalid.

source

pub fn get_by_type_id(&self, type_id: TypeId) -> Option<&ComponentInfo>

Gets the ComponentInfo for a component using its TypeId. Returns None if the TypeId does not map to a component.

source

pub fn contains(&self, id: ComponentId) -> bool

Does the given component exist in the world?

source

pub fn iter(&self) -> impl Iterator<Item = &ComponentInfo>

Returns an iterator over all component infos.

Trait Implementations§

source§

impl Debug for Components

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Index<ComponentId> for Components

§

type Output = ComponentInfo

The returned type after indexing.
source§

fn index(&self, index: ComponentId) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<ComponentIdx> for Components

§

type Output = ComponentInfo

The returned type after indexing.
source§

fn index(&self, index: ComponentIdx) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl Index<TypeId> for Components

§

type Output = ComponentInfo

The returned type after indexing.
source§

fn index(&self, index: TypeId) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl SystemParam for &Components

§

type State = ()

Persistent data stored in the system.
§

type Item<'a> = &'a Components

The type produced by this system param. This is expected to be the type of Self but with the lifetime of 'a.
source§

fn init( _world: &mut World, _config: &mut Config ) -> Result<Self::State, InitError>

Initializes the system using the input World and Config. Read more
source§

unsafe fn get<'a>( _state: &'a mut Self::State, _info: &'a SystemInfo, _event_ptr: EventPtr<'a>, world: UnsafeWorldCell<'a> ) -> Self::Item<'a>

Obtain an instance of the system parameter. Called whenever the system is called. Read more
source§

fn refresh_archetype(_state: &mut Self::State, _arch: &Archetype)

Refresh an archetype for this system param. Called whenever System::refresh_archetype is called.
source§

fn remove_archetype(_state: &mut Self::State, _arch: &Archetype)

Remove the given archetype for this system param. Called whenever System::remove_archetype is called.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.