use async_trait::async_trait;
#[async_trait]
pub trait AsyncReducer<S, A>
where
S: Sync + Send,
A: Sync + Send,
{
async fn run(&self, action: &A, state: &S) -> S;
#[allow(clippy::all)]
fn new() -> AsyncReducerItem<S, A>
where
Self: Default + Sized + Sync + Send + 'static,
{
Box::new(Self::default())
}
}
pub type AsyncReducerTraitObject<S, A> = dyn AsyncReducer<S, A> + Send + Sync;
pub type AsyncReducerItem<S, A> = Box<dyn AsyncReducer<S, A> + Send + Sync>;
pub type AsyncReducerVec<S, A> = Vec<AsyncReducerItem<S, A>>;