Skip to main content

Reducer

Trait Reducer 

Source
pub trait Reducer:
    Serialize
    + DeserializeOwned
    + Clone {
    type Action: Serialize + DeserializeOwned;

    // Required methods
    fn initial() -> Self;
    fn reduce(&self, action: Self::Action) -> Self;
}
Expand description

Trait for a reducer that knows how to initialize its state and reduce actions.

Required Associated Types§

Required Methods§

Source

fn initial() -> Self

Source

fn reduce(&self, action: Self::Action) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§