#[non_exhaustive]pub enum Control<Event> {
Continue,
Unchanged,
Changed,
Event(Event),
Quit,
}
Expand description
Result enum for event handling.
The result of an event is processed immediately after the function returns, before polling new events. This way an action can trigger another action which triggers the repaint without other events intervening.
If you ever need to return more than one result from event-handling, you can hand it to AppContext/RenderContext::queue(). Events in the queue are processed in order, and the return value of the event-handler comes last. If an error is returned, everything send to the queue will be executed nonetheless.
See
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Continue
Continue with event-handling. In the event-loop this waits for the next event.
Unchanged
Break event-handling without repaint. In the event-loop this waits for the next event.
Changed
Break event-handling and repaints/renders the application.
In the event-loop this calls render
.
Event(Event)
Eventhandling can cause secondary application specific events.
One common way is to return this Control::Message(my_event)
to reenter the event-loop with your own secondary event.
This acts quite like a message-queue to communicate between disconnected parts of your application. And indeed there is a hidden message-queue as part of the event-loop.
The other way is to call SalsaAppContext::queue to initiate such events.
Quit
Quit the application.
Trait Implementations§
Source§impl<Event> ConsumedEvent for Control<Event>
impl<Event> ConsumedEvent for Control<Event>
Source§fn is_consumed(&self) -> bool
fn is_consumed(&self) -> bool
Source§fn or_else_try<F, E>(self, f: F) -> Result<Self, E>
fn or_else_try<F, E>(self, f: F) -> Result<Self, E>
is_consumed()
as the split.Source§fn and_then<F>(self, f: F) -> Self
fn and_then<F>(self, f: F) -> Self
Source§fn and_then_try<F, E>(self, f: F) -> Result<Self, E>
fn and_then_try<F, E>(self, f: F) -> Result<Self, E>
Source§impl<Event> Ord for Control<Event>
impl<Event> Ord for Control<Event>
Source§impl<Event> PartialOrd for Control<Event>
impl<Event> PartialOrd for Control<Event>
impl<Event: Copy> Copy for Control<Event>
impl<Event> Eq for Control<Event>
Auto Trait Implementations§
impl<Event> Freeze for Control<Event>where
Event: Freeze,
impl<Event> RefUnwindSafe for Control<Event>where
Event: RefUnwindSafe,
impl<Event> Send for Control<Event>where
Event: Send,
impl<Event> Sync for Control<Event>where
Event: Sync,
impl<Event> Unpin for Control<Event>where
Event: Unpin,
impl<Event> UnwindSafe for Control<Event>where
Event: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more