pub struct Local<'s, T: Default + 'static> { /* private fields */ }Expand description
Per-handler local state. Stored inside the dispatch wrapper (e.g.
Callback or pipeline Stage), not in World.
Initialized with Default::default() at handler creation time. Mutated
freely at dispatch time — each handler/stage instance has its own
independent copy.
§Examples
ⓘ
fn count_events(mut count: Local<u64>, event: u32) {
*count += 1;
println!("event #{}: {}", *count, event);
}Trait Implementations§
Source§impl<T: Default + 'static> SystemParam for Local<'_, T>
impl<T: Default + 'static> SystemParam for Local<'_, T>
Source§type State = T
type State = T
Opaque state cached at build time (e.g.
ResourceId).Source§fn init(_registry: &Registry) -> T
fn init(_registry: &Registry) -> T
Resolve state from the registry. Called once at build time. Read more
Source§unsafe fn fetch<'s>(_world: &'s World, state: &'s mut T) -> Local<'s, T>
unsafe fn fetch<'s>(_world: &'s World, state: &'s mut T) -> Local<'s, T>
Fetch the item using cached state. Read more
Source§fn any_changed(_state: &T, _world: &World) -> bool
fn any_changed(_state: &T, _world: &World) -> bool
Returns
true if any resource this param depends on was modified
during the current sequence. Read moreSource§fn resource_id(state: &Self::State) -> Option<ResourceId>
fn resource_id(state: &Self::State) -> Option<ResourceId>
The ResourceId this param accesses, if any. Read more
Auto Trait Implementations§
impl<'s, T> Freeze for Local<'s, T>
impl<'s, T> RefUnwindSafe for Local<'s, T>where
T: RefUnwindSafe,
impl<'s, T> Send for Local<'s, T>where
T: Send,
impl<'s, T> Sync for Local<'s, T>where
T: Sync,
impl<'s, T> Unpin for Local<'s, T>
impl<'s, T> UnsafeUnpin for Local<'s, T>
impl<'s, T> !UnwindSafe for Local<'s, T>
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