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>
impl<'world> SystemInitContext<'world>
Sourcepub fn contains_resource<R: 'static>(&self) -> bool
pub fn contains_resource<R: 'static>(&self) -> bool
Whether the resource type is registered and present.
Sourcepub fn resource<R: 'static>(&self) -> Result<Option<&R>, WorldError>
pub fn resource<R: 'static>(&self) -> Result<Option<&R>, WorldError>
Read-only resource access during initializer execution.
Sourcepub fn event_reader<E: Clone + 'static>(
&mut self,
start: EventReaderStart,
) -> Result<EventReader<E>, WorldError>
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.
Sourcepub fn on_add_reader<T: 'static>(
&mut self,
start: EventReaderStart,
) -> Result<EventReader<ComponentAdded>, WorldError>
pub fn on_add_reader<T: 'static>( &mut self, start: EventReaderStart, ) -> Result<EventReader<ComponentAdded>, WorldError>
Persistent component-added lifecycle reader for this system.
Sourcepub fn on_remove_reader<T: 'static>(
&mut self,
start: EventReaderStart,
) -> Result<EventReader<ComponentRemoved>, WorldError>
pub fn on_remove_reader<T: 'static>( &mut self, start: EventReaderStart, ) -> Result<EventReader<ComponentRemoved>, WorldError>
Persistent component-removed lifecycle reader for this system.
Sourcepub fn prepare_query1<T: 'static>(
&mut self,
spec: QuerySpec,
policy: QueryPolicy,
) -> Result<PreparedQuery1<T>, QueryError>
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.
Sourcepub fn prepare_query2<A: 'static, B: 'static>(
&mut self,
spec: QuerySpec,
policy: QueryPolicy,
) -> Result<PreparedQuery2<A, B>, QueryError>
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> 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