Trait Callable

pub trait Callable<In, Out = ()>
where In: 'static, Out: 'static,
{ // Required methods fn try_run(&self, input: In) -> Option<Out>; fn run(&self, input: In) -> Out; }
Expand description

A wrapper trait for calling callbacks.

Required Methods§

fn try_run(&self, input: In) -> Option<Out>

calls the callback with the specified argument.

Returns None if the callback has been disposed

fn run(&self, input: In) -> Out

calls the callback with the specified argument.

§Panics

Panics if you try to run a callback that has been disposed

Implementors§

§

impl<In, Out> Callable<In, Out> for Callback<In, Out>

§

impl<In, Out> Callable<In, Out> for UnsyncCallback<In, Out>
where In: 'static, Out: 'static,