Skip to main content

Handler

Trait Handler 

Source
pub trait Handler<A, Marker> {
    // Required method
    fn call(self, payload: A);
}
Expand description

A callback prop that may or may not take the event payload.

Marker is (Arity0 | Arity1, ReturnType). It exists only to keep the zero-arg and one-arg impls from overlapping and to let the handler body evaluate to something other than (); it is inferred from the closure at every call site, so the macro can always emit a bare Handler::call(closure, payload).

Required Methods§

Source

fn call(self, payload: A)

Call the handler with the payload, dropping it if the handler is nullary.

Implementors§

Source§

impl<F: FnOnce() -> R, A, R> Handler<A, (Arity0, R)> for F

Source§

impl<F: FnOnce(A) -> R, A, R> Handler<A, (Arity1, R)> for F