Skip to main content

System

Trait System 

Source
pub trait System: Serialize + Deserialize {
    // Provided methods
    fn tick(&self, _scene: &mut Scene, _world: &mut World) { ... }
    fn on_event(
        &self,
        _scene: &mut Scene,
        _world: &mut World,
        _tag: &str,
        _data: &dyn Any,
    ) { ... }
}
Expand description

To be inherited by each ecs system

Provided Methods§

Source

fn tick(&self, _scene: &mut Scene, _world: &mut World)

Tick the system

Source

fn on_event( &self, _scene: &mut Scene, _world: &mut World, _tag: &str, _data: &dyn Any, )

Handle game event

Trait Implementations§

Source§

impl<'de> Deserialize<'de> for Box<dyn System>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'typetag> Serialize for dyn System + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn System + Send + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn System + Sync + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'typetag> Serialize for dyn System + Send + Sync + 'typetag

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§