pub trait Command: Send + 'static {
// Required method
fn command(&mut self, ecs: Ecs<'_>) -> DynResult<()>;
// Provided method
fn cancel(&mut self) { ... }
}Expand description
Command to an ECS instance.
Command is one way to modify ECS instance directly such as adding or removing systems. In the command method, an ECS handle is given and you can make change to the ECS insance using the handle.
§Example
use my_ecs::prelude::*;
struct MyCommand;
impl Command for MyCommand {
fn command(&mut self, mut ecs: Ecs) -> DynResult<()> {
ecs.add_system(|| { /* ... */}).take()?;
Ok(())
}
}Required Methods§
Provided Methods§
Trait Implementations§
Implementations on Foreign Types§
Source§impl Command for ()
Empty command.
impl Command for ()
Empty command.
This implementation allows clients make commands returning just (), called
unit.