pub trait System {
// Provided methods
fn prestep(&mut self, engine: &EntitiesAndComponentsThreadSafe<'_>) { ... }
fn implements_prestep(&self) -> bool { ... }
fn single_entity_step(&self, single_entity: &mut SingleMutEntity<'_>) { ... }
fn implements_single_entity_step(&self) -> bool { ... }
fn run(&mut self, engine: &mut EntitiesAndComponents) { ... }
}Expand description
Systems access and change components on objects Be careful to implement get_allow_entity_based_multithreading as true if you want to use the single_entity_step function If you don’t it will still work but, it will be slower (in most cases)
Provided Methods§
sourcefn prestep(&mut self, engine: &EntitiesAndComponentsThreadSafe<'_>)
fn prestep(&mut self, engine: &EntitiesAndComponentsThreadSafe<'_>)
This function can collect data that will be used in the single_entity_step function This allows both functions to be called in parallel, without a data race If you implement this function, make sure to implement implements_prestep as true
sourcefn implements_prestep(&self) -> bool
fn implements_prestep(&self) -> bool
Should just return true or false based on whether or not the system implements the prestep function
sourcefn single_entity_step(&self, single_entity: &mut SingleMutEntity<'_>)
fn single_entity_step(&self, single_entity: &mut SingleMutEntity<'_>)
If you implement this function, it will be called for each entity in parallel, but make sure to implement get_allow_single_entity_step as true
sourcefn implements_single_entity_step(&self) -> bool
fn implements_single_entity_step(&self) -> bool
Should just return true or false based on whether or not the system implements the single_entity_step function
sourcefn run(&mut self, engine: &mut EntitiesAndComponents)
fn run(&mut self, engine: &mut EntitiesAndComponents)
This function is called after the single_entity_step function is called for all entities