use crate::*; pub trait Command: Send + Sync + Sized { fn execute (self, state: &mut S) -> Perhaps; fn delegate (self, state: &mut S, wrap: impl Fn(Self)->T) -> Perhaps where Self: Sized { Ok(self.execute(state)?.map(wrap)) } } impl> Command for Option { fn execute (self, _: &mut S) -> Perhaps { Ok(None) } fn delegate (self, _: &mut S, _: impl Fn(Self)->U) -> Perhaps where Self: Sized { Ok(None) } }