Trait System

Source
pub trait System {
    // Required method
    fn aspect(&self) -> Aspect;

    // Provided methods
    fn data_aspects(&self) -> Vec<Aspect> { ... }
    fn on_created(&mut self, _: &mut EntityManager<'_>) { ... }
    fn on_begin_frame(&mut self) { ... }
    fn on_added(&mut self, _: &mut Entity) { ... }
    fn on_removed(&self, _: &mut Entity) { ... }
    fn on_end_frame(&mut self) { ... }
    fn process_w(&mut self, _: &mut Entity, _: &mut WorldHandle<'_>) { ... }
    fn process_d(&mut self, _: &mut Entity, _: &mut DataList<'_>) { ... }
    fn process_wd(
        &mut self,
        _: &mut Entity,
        _: &mut WorldHandle<'_>,
        _: &mut DataList<'_>,
    ) { ... }
    fn process_one(&mut self, _: &mut Entity) { ... }
    fn process_all(
        &mut self,
        entities: &mut Vec<&mut Entity>,
        world: &mut WorldHandle<'_>,
        data: &mut DataList<'_>,
    ) { ... }
}
Expand description

System trait

You can implement one of those processes, but if you implement process_all - only it will be called, and if you dont implement process_all - all process_* will be called.

Most common case - implement only process_one.

Required Methods§

Source

fn aspect(&self) -> Aspect

System will subscribe only on components, sutisfied by this aspect.

Provided Methods§

Source

fn data_aspects(&self) -> Vec<Aspect>

For each returned aspect, one additional entity pack DataList will be received. Strongly recomends use it only with registration macro.

Source

fn on_created(&mut self, _: &mut EntityManager<'_>)

Source

fn on_begin_frame(&mut self)

Source

fn on_added(&mut self, _: &mut Entity)

Source

fn on_removed(&self, _: &mut Entity)

Source

fn on_end_frame(&mut self)

Source

fn process_w(&mut self, _: &mut Entity, _: &mut WorldHandle<'_>)

Source

fn process_d(&mut self, _: &mut Entity, _: &mut DataList<'_>)

Source

fn process_wd( &mut self, _: &mut Entity, _: &mut WorldHandle<'_>, _: &mut DataList<'_>, )

Source

fn process_one(&mut self, _: &mut Entity)

Source

fn process_all( &mut self, entities: &mut Vec<&mut Entity>, world: &mut WorldHandle<'_>, data: &mut DataList<'_>, )

Implementors§