wip: implementing app command dispatch

This commit is contained in:
🪞👃🪞 2025-01-14 19:03:08 +01:00
parent d393cab2d8
commit 12faadef44
31 changed files with 598 additions and 551 deletions

View file

@ -10,7 +10,9 @@ use crate::*;
}
pub trait Command<S>: Send + Sync + Sized {
fn execute (self, state: &mut S) -> Perhaps<Self>;
fn delegate <T> (self, state: &mut S, wrap: impl Fn(Self)->T) -> Perhaps<T> {
fn delegate <T> (self, state: &mut S, wrap: impl Fn(Self)->T) -> Perhaps<T>
where Self: Sized
{
Ok(self.execute(state)?.map(wrap))
}
}