use std::marker::PhantomData;
use crate::Result;
pub trait Reducer<T>: Send + Sync {
fn reduce(&self, current: T, update: T) -> Result<T>;
}
pub trait StateReducer<State, Update>: Send + Sync {
fn apply(&self, state: State, update: Update) -> Result<State>;
}
#[derive(Clone, Copy, Debug, Default)]
pub struct OverwriteReducer;
#[derive(Clone, Copy, Debug, Default)]
pub struct AppendReducer;
#[derive(Clone, Copy, Debug, Default)]
pub struct SetUnionReducer;
#[derive(Clone, Copy, Debug, Default)]
pub struct MinReducer;
#[derive(Clone, Copy, Debug, Default)]
pub struct MaxReducer;
pub struct ClosureReducer<T, F> {
pub(crate) f: F,
pub(crate) _marker: PhantomData<fn(T, T) -> T>,
}
#[derive(Clone, Copy, Debug, Default)]
pub struct OverwriteStateReducer;
pub struct ClosureStateReducer<State, Update, F> {
pub(crate) f: F,
pub(crate) _marker: PhantomData<fn(State, Update) -> State>,
}