Skip to main content

System

Trait System 

Source
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 { ... }
}
Expand description

A type-erased, executable system.

Required Methods§

Source

fn run(&mut self, world: &World, resources: &Resources)

Provided Methods§

Source

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.

Source

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.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<S: System, C: RunCondition> System for Conditional<S, C>

Source§

impl<S: System, F: Fn(&World, &Resources) -> bool + 'static> System for ConditionalFn<S, F>

Source§

impl<T, A, B, C, D, E, F, G, H, I, J, K, L> System for FunctionSystem<T, (A, B, C, D, E, F, G, H, I, J, K, L), (A::State, B::State, C::State, D::State, E::State, F::State, G::State, H::State, I::State, J::State, K::State, L::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>, E::Item<'a>, F::Item<'a>, G::Item<'a>, H::Item<'a>, I::Item<'a>, J::Item<'a>, K::Item<'a>, L::Item<'a>) + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static, E: SystemParam + 'static, F: SystemParam + 'static, G: SystemParam + 'static, H: SystemParam + 'static, I: SystemParam + 'static, J: SystemParam + 'static, K: SystemParam + 'static, L: SystemParam + 'static,

Source§

impl<T, A, B, C, D, E, F, G, H, I, J, K, L> System for OnceFunctionSystem<T, (A, B, C, D, E, F, G, H, I, J, K, L), (A::State, B::State, C::State, D::State, E::State, F::State, G::State, H::State, I::State, J::State, K::State, L::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>, E::Item<'a>, F::Item<'a>, G::Item<'a>, H::Item<'a>, I::Item<'a>, J::Item<'a>, K::Item<'a>, L::Item<'a>) -> Option<()> + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static, E: SystemParam + 'static, F: SystemParam + 'static, G: SystemParam + 'static, H: SystemParam + 'static, I: SystemParam + 'static, J: SystemParam + 'static, K: SystemParam + 'static, L: SystemParam + 'static,

Source§

impl<T, A, B, C, D, E, F, G, H, I, J, K> System for FunctionSystem<T, (A, B, C, D, E, F, G, H, I, J, K), (A::State, B::State, C::State, D::State, E::State, F::State, G::State, H::State, I::State, J::State, K::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>, E::Item<'a>, F::Item<'a>, G::Item<'a>, H::Item<'a>, I::Item<'a>, J::Item<'a>, K::Item<'a>) + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static, E: SystemParam + 'static, F: SystemParam + 'static, G: SystemParam + 'static, H: SystemParam + 'static, I: SystemParam + 'static, J: SystemParam + 'static, K: SystemParam + 'static,

Source§

impl<T, A, B, C, D, E, F, G, H, I, J, K> System for OnceFunctionSystem<T, (A, B, C, D, E, F, G, H, I, J, K), (A::State, B::State, C::State, D::State, E::State, F::State, G::State, H::State, I::State, J::State, K::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>, E::Item<'a>, F::Item<'a>, G::Item<'a>, H::Item<'a>, I::Item<'a>, J::Item<'a>, K::Item<'a>) -> Option<()> + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static, E: SystemParam + 'static, F: SystemParam + 'static, G: SystemParam + 'static, H: SystemParam + 'static, I: SystemParam + 'static, J: SystemParam + 'static, K: SystemParam + 'static,

Source§

impl<T, A, B, C, D, E, F, G, H, I, J> System for FunctionSystem<T, (A, B, C, D, E, F, G, H, I, J), (A::State, B::State, C::State, D::State, E::State, F::State, G::State, H::State, I::State, J::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>, E::Item<'a>, F::Item<'a>, G::Item<'a>, H::Item<'a>, I::Item<'a>, J::Item<'a>) + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static, E: SystemParam + 'static, F: SystemParam + 'static, G: SystemParam + 'static, H: SystemParam + 'static, I: SystemParam + 'static, J: SystemParam + 'static,

Source§

impl<T, A, B, C, D, E, F, G, H, I, J> System for OnceFunctionSystem<T, (A, B, C, D, E, F, G, H, I, J), (A::State, B::State, C::State, D::State, E::State, F::State, G::State, H::State, I::State, J::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>, E::Item<'a>, F::Item<'a>, G::Item<'a>, H::Item<'a>, I::Item<'a>, J::Item<'a>) -> Option<()> + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static, E: SystemParam + 'static, F: SystemParam + 'static, G: SystemParam + 'static, H: SystemParam + 'static, I: SystemParam + 'static, J: SystemParam + 'static,

Source§

impl<T, A, B, C, D, E, F, G, H, I> System for FunctionSystem<T, (A, B, C, D, E, F, G, H, I), (A::State, B::State, C::State, D::State, E::State, F::State, G::State, H::State, I::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>, E::Item<'a>, F::Item<'a>, G::Item<'a>, H::Item<'a>, I::Item<'a>) + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static, E: SystemParam + 'static, F: SystemParam + 'static, G: SystemParam + 'static, H: SystemParam + 'static, I: SystemParam + 'static,

Source§

impl<T, A, B, C, D, E, F, G, H, I> System for OnceFunctionSystem<T, (A, B, C, D, E, F, G, H, I), (A::State, B::State, C::State, D::State, E::State, F::State, G::State, H::State, I::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>, E::Item<'a>, F::Item<'a>, G::Item<'a>, H::Item<'a>, I::Item<'a>) -> Option<()> + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static, E: SystemParam + 'static, F: SystemParam + 'static, G: SystemParam + 'static, H: SystemParam + 'static, I: SystemParam + 'static,

Source§

impl<T, A, B, C, D, E, F, G, H> System for FunctionSystem<T, (A, B, C, D, E, F, G, H), (A::State, B::State, C::State, D::State, E::State, F::State, G::State, H::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>, E::Item<'a>, F::Item<'a>, G::Item<'a>, H::Item<'a>) + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static, E: SystemParam + 'static, F: SystemParam + 'static, G: SystemParam + 'static, H: SystemParam + 'static,

Source§

impl<T, A, B, C, D, E, F, G, H> System for OnceFunctionSystem<T, (A, B, C, D, E, F, G, H), (A::State, B::State, C::State, D::State, E::State, F::State, G::State, H::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>, E::Item<'a>, F::Item<'a>, G::Item<'a>, H::Item<'a>) -> Option<()> + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static, E: SystemParam + 'static, F: SystemParam + 'static, G: SystemParam + 'static, H: SystemParam + 'static,

Source§

impl<T, A, B, C, D, E, F, G> System for FunctionSystem<T, (A, B, C, D, E, F, G), (A::State, B::State, C::State, D::State, E::State, F::State, G::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>, E::Item<'a>, F::Item<'a>, G::Item<'a>) + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static, E: SystemParam + 'static, F: SystemParam + 'static, G: SystemParam + 'static,

Source§

impl<T, A, B, C, D, E, F, G> System for OnceFunctionSystem<T, (A, B, C, D, E, F, G), (A::State, B::State, C::State, D::State, E::State, F::State, G::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>, E::Item<'a>, F::Item<'a>, G::Item<'a>) -> Option<()> + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static, E: SystemParam + 'static, F: SystemParam + 'static, G: SystemParam + 'static,

Source§

impl<T, A, B, C, D, E, F> System for FunctionSystem<T, (A, B, C, D, E, F), (A::State, B::State, C::State, D::State, E::State, F::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>, E::Item<'a>, F::Item<'a>) + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static, E: SystemParam + 'static, F: SystemParam + 'static,

Source§

impl<T, A, B, C, D, E, F> System for OnceFunctionSystem<T, (A, B, C, D, E, F), (A::State, B::State, C::State, D::State, E::State, F::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>, E::Item<'a>, F::Item<'a>) -> Option<()> + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static, E: SystemParam + 'static, F: SystemParam + 'static,

Source§

impl<T, A, B, C, D, E> System for FunctionSystem<T, (A, B, C, D, E), (A::State, B::State, C::State, D::State, E::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>, E::Item<'a>) + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static, E: SystemParam + 'static,

Source§

impl<T, A, B, C, D, E> System for OnceFunctionSystem<T, (A, B, C, D, E), (A::State, B::State, C::State, D::State, E::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>, E::Item<'a>) -> Option<()> + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static, E: SystemParam + 'static,

Source§

impl<T, A, B, C, D> System for FunctionSystem<T, (A, B, C, D), (A::State, B::State, C::State, D::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>) + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static,

Source§

impl<T, A, B, C, D> System for OnceFunctionSystem<T, (A, B, C, D), (A::State, B::State, C::State, D::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>, D::Item<'a>) -> Option<()> + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static, D: SystemParam + 'static,

Source§

impl<T, A, B, C> System for FunctionSystem<T, (A, B, C), (A::State, B::State, C::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>) + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static,

Source§

impl<T, A, B, C> System for OnceFunctionSystem<T, (A, B, C), (A::State, B::State, C::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>, C::Item<'a>) -> Option<()> + 'static, A: SystemParam + 'static, B: SystemParam + 'static, C: SystemParam + 'static,

Source§

impl<T, A, B> System for FunctionSystem<T, (A, B), (A::State, B::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>) + 'static, A: SystemParam + 'static, B: SystemParam + 'static,

Source§

impl<T, A, B> System for OnceFunctionSystem<T, (A, B), (A::State, B::State)>
where T: for<'a> FnMut(A::Item<'a>, B::Item<'a>) -> Option<()> + 'static, A: SystemParam + 'static, B: SystemParam + 'static,

Source§

impl<T, A> System for FunctionSystem<T, (A,), (A::State,)>
where T: for<'a> FnMut(A::Item<'a>) + 'static, A: SystemParam + 'static,

Source§

impl<T, A> System for OnceFunctionSystem<T, (A,), (A::State,)>
where T: for<'a> FnMut(A::Item<'a>) -> Option<()> + 'static, A: SystemParam + 'static,

Source§

impl<T> System for FunctionSystem<T, (), ()>
where T: for<'a> FnMut() + 'static,

Source§

impl<T> System for OnceFunctionSystem<T, (), ()>
where T: for<'a> FnMut() -> Option<()> + 'static,