Trait specs::SystemData
source · pub trait SystemData<'a> {
fn setup(res: &mut Resources);
fn fetch(res: &'a Resources) -> Self;
fn reads() -> Vec<ResourceId, Global>;
fn writes() -> Vec<ResourceId, Global>;
}
Expand description
A static system data that can specify its dependencies at statically (at compile-time).
Most system data is a SystemData
, the DynamicSystemData
type is only needed for very special
setups.
Required Methods
sourcefn fetch(res: &'a Resources) -> Self
fn fetch(res: &'a Resources) -> Self
Fetches the system data from Resources
. Note that this is only specified for one concrete
lifetime 'a
, you need to implement the SystemData
trait for every possible
lifetime.
sourcefn reads() -> Vec<ResourceId, Global>
fn reads() -> Vec<ResourceId, Global>
Returns all read dependencies as fetched from Self::fetch
.
Please note that returning wrong dependencies can lead to a panic.
sourcefn writes() -> Vec<ResourceId, Global>
fn writes() -> Vec<ResourceId, Global>
Returns all write dependencies as fetched from Self::fetch
.
Please note that returning wrong dependencies can lead to a panic.