Handler

Enum Handler 

Source
pub enum Handler<Message> {
    Msg(Message),
    Event(fn(Event) -> Option<Message>),
    MsgEvent(Message, fn(Message, Event) -> Option<Message>),
    InputValue(fn(String) -> Option<Message>),
    InputEvent(fn(InputEvent) -> Option<Message>),
}
Expand description

A DOM event handler.

Variants§

§

Msg(Message)

The message that will result from the event this handler is attached to.

§

Event(fn(Event) -> Option<Message>)

A function that will convert a web_sys::Event event to a Message.

§

MsgEvent(Message, fn(Message, Event) -> Option<Message>)

A function that will convert a web_sys::Event event to a Message.

This variation allows passing data to the event handler via a Message.

§

InputValue(fn(String) -> Option<Message>)

A function that will convert a String from an input element into a Message.

§

InputEvent(fn(InputEvent) -> Option<Message>)

A function that will convert a web_sys::InputEvent event to a Message.

Trait Implementations§

Source§

impl<Message: Debug> Debug for Handler<Message>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Message: PartialEq> PartialEq for Handler<Message>

Source§

fn eq(&self, other: &Handler<Message>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Message> StructuralPartialEq for Handler<Message>

Auto Trait Implementations§

§

impl<Message> Freeze for Handler<Message>
where Message: Freeze,

§

impl<Message> RefUnwindSafe for Handler<Message>
where Message: RefUnwindSafe,

§

impl<Message> Send for Handler<Message>
where Message: Send,

§

impl<Message> Sync for Handler<Message>
where Message: Sync,

§

impl<Message> Unpin for Handler<Message>
where Message: Unpin,

§

impl<Message> UnwindSafe for Handler<Message>
where Message: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<M> Update<()> for M

Source§

fn update(&mut self, msg: Message, _commands: &mut Commands<Command>)

Update the model using the given message. Implement this to describe the behavior of your app.
Source§

fn simple_update(&mut self, _msg: Message)

Update the model using the given message. Implement this if your app does not need to use side effecting commands.