Skip to main content

IntoCallback

Trait IntoCallback 

Source
pub trait IntoCallback<C, E, Params> {
    type Callback: Handler<E>;

    // Required method
    fn into_callback(self, ctx: C, registry: &mut Registry) -> Self::Callback;
}
Expand description

Converts a named function into a Callback.

Identical to IntoHandler but injects &mut C as the first parameter. ResourceIds resolved via registry.id::<T>() at call time — panics if any resource is not registered.

§Named functions only

Closures do not work with IntoCallback due to Rust’s HRTB inference limitations with GATs. Use named fn items instead.

§Panics

Panics if any SystemParam resource is not registered.

Required Associated Types§

Source

type Callback: Handler<E>

The concrete Callback type produced.

Required Methods§

Source

fn into_callback(self, ctx: C, registry: &mut Registry) -> Self::Callback

Convert this function + context into a Callback.

Implementors§

Source§

impl<C: 'static, E, F: 'static, P0: SystemParam + 'static> IntoCallback<C, E, (P0,)> for F
where for<'a> &'a mut F: FnMut(&mut C, P0, E) + FnMut(&mut C, P0::Item<'a>, E),

Source§

impl<C: 'static, E, F: 'static, P0: SystemParam + 'static, P1: SystemParam + 'static> IntoCallback<C, E, (P0, P1)> for F
where for<'a> &'a mut F: FnMut(&mut C, P0, P1, E) + FnMut(&mut C, P0::Item<'a>, P1::Item<'a>, E),

Source§

impl<C: 'static, E, F: 'static, P0: SystemParam + 'static, P1: SystemParam + 'static, P2: SystemParam + 'static> IntoCallback<C, E, (P0, P1, P2)> for F
where for<'a> &'a mut F: FnMut(&mut C, P0, P1, P2, E) + FnMut(&mut C, P0::Item<'a>, P1::Item<'a>, P2::Item<'a>, E),

Source§

impl<C: 'static, E, F: 'static, P0: SystemParam + 'static, P1: SystemParam + 'static, P2: SystemParam + 'static, P3: SystemParam + 'static> IntoCallback<C, E, (P0, P1, P2, P3)> for F
where for<'a> &'a mut F: FnMut(&mut C, P0, P1, P2, P3, E) + FnMut(&mut C, P0::Item<'a>, P1::Item<'a>, P2::Item<'a>, P3::Item<'a>, E),

Source§

impl<C: 'static, E, F: 'static, P0: SystemParam + 'static, P1: SystemParam + 'static, P2: SystemParam + 'static, P3: SystemParam + 'static, P4: SystemParam + 'static> IntoCallback<C, E, (P0, P1, P2, P3, P4)> for F
where for<'a> &'a mut F: FnMut(&mut C, P0, P1, P2, P3, P4, E) + FnMut(&mut C, P0::Item<'a>, P1::Item<'a>, P2::Item<'a>, P3::Item<'a>, P4::Item<'a>, E),

Source§

impl<C: 'static, E, F: 'static, P0: SystemParam + 'static, P1: SystemParam + 'static, P2: SystemParam + 'static, P3: SystemParam + 'static, P4: SystemParam + 'static, P5: SystemParam + 'static> IntoCallback<C, E, (P0, P1, P2, P3, P4, P5)> for F
where for<'a> &'a mut F: FnMut(&mut C, P0, P1, P2, P3, P4, P5, E) + FnMut(&mut C, P0::Item<'a>, P1::Item<'a>, P2::Item<'a>, P3::Item<'a>, P4::Item<'a>, P5::Item<'a>, E),

Source§

impl<C: 'static, E, F: 'static, P0: SystemParam + 'static, P1: SystemParam + 'static, P2: SystemParam + 'static, P3: SystemParam + 'static, P4: SystemParam + 'static, P5: SystemParam + 'static, P6: SystemParam + 'static> IntoCallback<C, E, (P0, P1, P2, P3, P4, P5, P6)> for F
where for<'a> &'a mut F: FnMut(&mut C, P0, P1, P2, P3, P4, P5, P6, E) + FnMut(&mut C, P0::Item<'a>, P1::Item<'a>, P2::Item<'a>, P3::Item<'a>, P4::Item<'a>, P5::Item<'a>, P6::Item<'a>, E),

Source§

impl<C: 'static, E, F: 'static, P0: SystemParam + 'static, P1: SystemParam + 'static, P2: SystemParam + 'static, P3: SystemParam + 'static, P4: SystemParam + 'static, P5: SystemParam + 'static, P6: SystemParam + 'static, P7: SystemParam + 'static> IntoCallback<C, E, (P0, P1, P2, P3, P4, P5, P6, P7)> for F
where for<'a> &'a mut F: FnMut(&mut C, P0, P1, P2, P3, P4, P5, P6, P7, E) + FnMut(&mut C, P0::Item<'a>, P1::Item<'a>, P2::Item<'a>, P3::Item<'a>, P4::Item<'a>, P5::Item<'a>, P6::Item<'a>, P7::Item<'a>, E),

Source§

impl<C: 'static, E, F: FnMut(&mut C, E) + 'static> IntoCallback<C, E, ()> for F