pub trait Command: 'static {
// Required method
fn apply(
self: Box<Self>,
world: &mut World,
) -> Result<(), EntityAccessError>;
}Expand description
A structural change that can be applied later.
Required Methods§
Sourcefn apply(self: Box<Self>, world: &mut World) -> Result<(), EntityAccessError>
fn apply(self: Box<Self>, world: &mut World) -> Result<(), EntityAccessError>
Apply the change to the world.
Most commands cannot fail: they check what they are allowed to touch when they are queued and again when they are applied, and a change that no longer applies is dropped. Only a command that spawns on a reserved handle has something to report, so it answers the error instead of panicking on it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".