Skip to main content

SystemInitContext

Struct SystemInitContext 

Source
pub struct SystemInitContext<'world> { /* private fields */ }
Expand description

Restricted build-time access used to create persistent system-local state.

Initializers may inspect resources and create event readers, but cannot mutate the world. The context is constructed only while a schedule builds.

Implementations§

Source§

impl<'world> SystemInitContext<'world>

Source

pub fn contains_resource<R: 'static>(&self) -> bool

Whether the resource type is registered and present.

Source

pub fn resource<R: 'static>(&self) -> Result<Option<&R>, WorldError>

Read-only resource access during initializer execution.

Source

pub fn event_reader<E: Clone + 'static>( &mut self, start: EventReaderStart, ) -> Result<EventReader<E>, WorldError>

Persistent event reader seeded for the compiled system’s lifetime.

Source

pub fn on_add_reader<T: 'static>( &mut self, start: EventReaderStart, ) -> Result<EventReader<ComponentAdded>, WorldError>

Persistent component-added lifecycle reader for this system.

Source

pub fn on_remove_reader<T: 'static>( &mut self, start: EventReaderStart, ) -> Result<EventReader<ComponentRemoved>, WorldError>

Persistent component-removed lifecycle reader for this system.

Source

pub fn prepare_query1<T: 'static>( &mut self, spec: QuerySpec, policy: QueryPolicy, ) -> Result<PreparedQuery1<T>, QueryError>

Resolves and stores a reusable single-component query for this system.

Source

pub fn prepare_query2<A: 'static, B: 'static>( &mut self, spec: QuerySpec, policy: QueryPolicy, ) -> Result<PreparedQuery2<A, B>, QueryError>

Resolves and stores a reusable two-component query for this system.

Auto Trait Implementations§

§

impl<'world> !RefUnwindSafe for SystemInitContext<'world>

§

impl<'world> !Send for SystemInitContext<'world>

§

impl<'world> !Sync for SystemInitContext<'world>

§

impl<'world> !UnwindSafe for SystemInitContext<'world>

§

impl<'world> Freeze for SystemInitContext<'world>

§

impl<'world> Unpin for SystemInitContext<'world>

§

impl<'world> UnsafeUnpin for SystemInitContext<'world>

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.

Source§

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

Source§

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>,

Source§

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.