Skip to main content

Handler

Trait Handler 

Source
pub trait Handler<C, R, O, E, Params> {
    // Required method
    fn run(
        &self,
        context: &mut C,
        resources: &mut R,
    ) -> Result<O, StageError<E>>;
}
Expand description

Adapts a typed command function to a uniform resource-aware invocation.

Params is a tuple of SystemParam marker types. Implementations are provided for functions with zero through eight injected arguments. Most applications create the adapter through crate::command!.

Required Methods§

Source

fn run(&self, context: &mut C, resources: &mut R) -> Result<O, StageError<E>>

Validates resource access, extracts arguments, and invokes the function.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<C, R, O, E, F, P0, P1, P2, P3, P4, P5, P6, P7> Handler<C, R, O, E, (P0, P1, P2, P3, P4, P5, P6, P7)> for F
where P0: SystemParam<R>, P1: SystemParam<R>, P2: SystemParam<R>, P3: SystemParam<R>, P4: SystemParam<R>, P5: SystemParam<R>, P6: SystemParam<R>, P7: SystemParam<R>, for<'context, 'resources> F: Fn(&mut C, P0, P1, P2, P3, P4, P5, P6, P7) -> Result<O, E> + Fn(&'context mut C, P0::Item<'resources>, P1::Item<'resources>, P2::Item<'resources>, P3::Item<'resources>, P4::Item<'resources>, P5::Item<'resources>, P6::Item<'resources>, P7::Item<'resources>) -> Result<O, E>,

Source§

impl<C, R, O, E, F, P0, P1, P2, P3, P4, P5, P6> Handler<C, R, O, E, (P0, P1, P2, P3, P4, P5, P6)> for F
where P0: SystemParam<R>, P1: SystemParam<R>, P2: SystemParam<R>, P3: SystemParam<R>, P4: SystemParam<R>, P5: SystemParam<R>, P6: SystemParam<R>, for<'context, 'resources> F: Fn(&mut C, P0, P1, P2, P3, P4, P5, P6) -> Result<O, E> + Fn(&'context mut C, P0::Item<'resources>, P1::Item<'resources>, P2::Item<'resources>, P3::Item<'resources>, P4::Item<'resources>, P5::Item<'resources>, P6::Item<'resources>) -> Result<O, E>,

Source§

impl<C, R, O, E, F, P0, P1, P2, P3, P4, P5> Handler<C, R, O, E, (P0, P1, P2, P3, P4, P5)> for F
where P0: SystemParam<R>, P1: SystemParam<R>, P2: SystemParam<R>, P3: SystemParam<R>, P4: SystemParam<R>, P5: SystemParam<R>, for<'context, 'resources> F: Fn(&mut C, P0, P1, P2, P3, P4, P5) -> Result<O, E> + Fn(&'context mut C, P0::Item<'resources>, P1::Item<'resources>, P2::Item<'resources>, P3::Item<'resources>, P4::Item<'resources>, P5::Item<'resources>) -> Result<O, E>,

Source§

impl<C, R, O, E, F, P0, P1, P2, P3, P4> Handler<C, R, O, E, (P0, P1, P2, P3, P4)> for F
where P0: SystemParam<R>, P1: SystemParam<R>, P2: SystemParam<R>, P3: SystemParam<R>, P4: SystemParam<R>, for<'context, 'resources> F: Fn(&mut C, P0, P1, P2, P3, P4) -> Result<O, E> + Fn(&'context mut C, P0::Item<'resources>, P1::Item<'resources>, P2::Item<'resources>, P3::Item<'resources>, P4::Item<'resources>) -> Result<O, E>,

Source§

impl<C, R, O, E, F, P0, P1, P2, P3> Handler<C, R, O, E, (P0, P1, P2, P3)> for F
where P0: SystemParam<R>, P1: SystemParam<R>, P2: SystemParam<R>, P3: SystemParam<R>, for<'context, 'resources> F: Fn(&mut C, P0, P1, P2, P3) -> Result<O, E> + Fn(&'context mut C, P0::Item<'resources>, P1::Item<'resources>, P2::Item<'resources>, P3::Item<'resources>) -> Result<O, E>,

Source§

impl<C, R, O, E, F, P0, P1, P2> Handler<C, R, O, E, (P0, P1, P2)> for F
where P0: SystemParam<R>, P1: SystemParam<R>, P2: SystemParam<R>, for<'context, 'resources> F: Fn(&mut C, P0, P1, P2) -> Result<O, E> + Fn(&'context mut C, P0::Item<'resources>, P1::Item<'resources>, P2::Item<'resources>) -> Result<O, E>,

Source§

impl<C, R, O, E, F, P0, P1> Handler<C, R, O, E, (P0, P1)> for F
where P0: SystemParam<R>, P1: SystemParam<R>, for<'context, 'resources> F: Fn(&mut C, P0, P1) -> Result<O, E> + Fn(&'context mut C, P0::Item<'resources>, P1::Item<'resources>) -> Result<O, E>,

Source§

impl<C, R, O, E, F, P0> Handler<C, R, O, E, (P0,)> for F
where P0: SystemParam<R>, for<'context, 'resources> F: Fn(&mut C, P0) -> Result<O, E> + Fn(&'context mut C, P0::Item<'resources>) -> Result<O, E>,

Source§

impl<C, R, O, E, F> Handler<C, R, O, E, ()> for F
where F: Fn(&mut C) -> Result<O, E>,