Skip to main content

UpdateFn

Trait UpdateFn 

Source
pub trait UpdateFn<State, Message> {
    // Required method
    fn update(&self, state: &mut State, message: Message) -> Task<Message>;
}
Expand description

The update logic of some Application.

This trait allows the application builder to take any closure that returns any Into<Task<Message>>.

Required Methods§

Source

fn update(&self, state: &mut State, message: Message) -> Task<Message>

Processes the message and updates the state of the Application.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<State> UpdateFn<State, Infallible> for ()

Source§

fn update(&self, _state: &mut State, _message: Never) -> Task<Never>

Implementors§

Source§

impl<T, State, Message, C> UpdateFn<State, Message> for T
where T: Fn(&mut State, Message) -> C, C: Into<Task<Message>>,