Trait bones_lib::prelude::SystemParam
pub trait SystemParam: Sized {
type State;
type Param<'s>;
// Required methods
fn get_state(world: &World) -> Self::State;
fn borrow<'s>(
world: &'s World,
state: &'s mut Self::State,
) -> Self::Param<'s>;
}
Expand description
Trait used to implement parameters for System
functions.
Functions that only take arguments implementing SystemParam
automatically implment
IntoSystem
.
Implementing SystemParam
manually can be useful for creating new kinds of parameters you may
use in your system funciton arguments. Examples might inlclude event readers and writers or
other custom ways to access the data inside a World
.
Required Associated Types§
type State
type State
The intermediate state for the parameter, that may be extracted from the world.
type Param<'s>
type Param<'s>
The type of the parameter, ranging over the lifetime of the intermediate state.
ℹ️ Important: This type must be the same type as
Self
, other than the fact that it may range over the lifetime's
instead of a generic lifetime from yourimpl
.If the type is not the same, then system functions will not be able to take it as an argument.