pub struct StaticSystemParam<S: SystemParamState> { /* private fields */ }Expand description
A system parameter that provides access to its inner state directly.
StaticSystemParam is useful when you want to store data in the parameter
state and access it during system execution. Unlike Local<T>, this
stores the data in the system’s state rather than per-system instance.
§Example
use goud_engine::ecs::World;
use goud_engine::ecs::query::Access;
use goud_engine::ecs::system::{SystemParam, SystemParamState, StaticSystemParam};
// State that tracks how many times the system ran
#[derive(Default)]
struct RunCountState {
count: u32,
}
impl SystemParamState for RunCountState {
fn init(_world: &mut World) -> Self {
Self::default()
}
}
// The parameter type
type RunCount = StaticSystemParam<RunCountState>;Trait Implementations§
Source§impl<S: Debug + SystemParamState> Debug for StaticSystemParam<S>
impl<S: Debug + SystemParamState> Debug for StaticSystemParam<S>
Source§impl<S: SystemParamState + 'static> SystemParam for StaticSystemParam<S>
impl<S: SystemParamState + 'static> SystemParam for StaticSystemParam<S>
Source§type State = StaticSystemParamState<S>
type State = StaticSystemParamState<S>
The cached state for this parameter. Read more
Source§fn update_access(_state: &Self::State, _access: &mut Access)
fn update_access(_state: &Self::State, _access: &mut Access)
Updates the access pattern for this parameter. Read more
Auto Trait Implementations§
impl<S> Freeze for StaticSystemParam<S>
impl<S> RefUnwindSafe for StaticSystemParam<S>
impl<S> Send for StaticSystemParam<S>
impl<S> Sync for StaticSystemParam<S>
impl<S> Unpin for StaticSystemParam<S>
impl<S> UnsafeUnpin for StaticSystemParam<S>
impl<S> UnwindSafe for StaticSystemParam<S>
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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