pub trait System: 'static {
// Required method
fn run(&mut self, world: &World, resources: &Resources);
// Provided methods
fn requires(&self) -> Vec<RequiredResource> { ... }
fn name(&self) -> &'static str { ... }
fn ordering_id(&self) -> TypeId { ... }
fn after_ids(&self) -> &[TypeId] { ... }
fn before_ids(&self) -> &[TypeId] { ... }
}Expand description
A type-erased, executable system.
Required Methods§
Provided Methods§
Sourcefn requires(&self) -> Vec<RequiredResource>
fn requires(&self) -> Vec<RequiredResource>
Resource types this system needs present, derived automatically from
its bare Res/ResMut parameters. App
checks these before running a non-convergent stage’s systems and
panics with a clear message naming the missing resource(s) rather
than letting a param fetch panic deep inside whichever system happens
to run first.
Sourcefn name(&self) -> &'static str
fn name(&self) -> &'static str
Human-readable identifier for this system, used in error/trace output
so a missing-resource failure can be pinned to the system that needs
it instead of just the resource name. Defaults to the type name of
the System impl; FunctionSystem overrides this with the name
of the wrapped function/closure, which is far more legible.
Sourcefn ordering_id(&self) -> TypeId
fn ordering_id(&self) -> TypeId
This system’s identity for ordering purposes — the TypeId
of the function/closure it wraps. Automatic: every distinct function
or closure has a distinct type, so no manual labeling is needed to
make a system a valid target for another system’s
after/before.
Defaults to Self’s own TypeId; FunctionSystem/OnceFunctionSystem
override it with the wrapped function’s TypeId instead of the
wrapper’s, so ordering constraints referencing the bare function match.
Sourcefn after_ids(&self) -> &[TypeId]
fn after_ids(&self) -> &[TypeId]
Other systems in the same stage that must run before this one. Set
via SystemOrderingExt::after. A referenced system that isn’t
registered in the same stage is silently ignored.
Sourcefn before_ids(&self) -> &[TypeId]
fn before_ids(&self) -> &[TypeId]
Other systems in the same stage that must run after this one. Set
via SystemOrderingExt::before. A referenced system that isn’t
registered in the same stage is silently ignored.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".