Skip to main content

EffectFunction

Trait EffectFunction 

Source
pub trait EffectFunction<T, M> {
    // Required method
    fn run(&mut self, p: Option<T>) -> T;
}
Expand description

Trait to enable effect functions that have zero or one parameter

Required Methods§

Source

fn run(&mut self, p: Option<T>) -> T

Call this to execute the function. In case the actual function has no parameters the parameter p will simply be ignored.

Implementors§

Source§

impl<Func> EffectFunction<(), NoParam> for Func
where Func: FnMut(),

Source§

impl<Func, T> EffectFunction<T, SingleParam> for Func
where Func: FnMut(Option<T>) -> T,