Skip to main content

State

Trait State 

Source
pub trait State:
    Clone
    + Serialize
    + for<'de> Deserialize<'de>
    + Send
    + Sync {
    type Message: Send;

    // Required method
    fn update(&mut self, msg: Self::Message) -> Command<Self::Message>;
}
Expand description

Application state trait.

Implements the Elm Architecture: State + Message → (State, Command)

Required Associated Types§

Source

type Message: Send

Message type for state updates

Required Methods§

Source

fn update(&mut self, msg: Self::Message) -> Command<Self::Message>

Update state in response to a message.

Returns a command for side effects (async operations, navigation, etc.)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§