pub enum InputEvent {
Key(KeyEvent),
Mouse(MouseEvent),
Tick,
}Expand description
An input event that can be handled by the application.
InputEvent wraps the different types of input the application can receive:
keyboard events, mouse events, and periodic tick events for animations or updates.
Use handle to dispatch the event to the appropriate
keybinding or pointer handler.
§Example
ⓘ
match crossterm::event::read()? {
Event::Key(key) => InputEvent::Key(key).handle(&mut world, &active_widgets),
Event::Mouse(mouse) => InputEvent::Mouse(mouse).handle(&mut world, &active_widgets),
_ => {}
}Variants§
Key(KeyEvent)
A keyboard event.
Mouse(MouseEvent)
A mouse event (click, drag, scroll, etc.).
Tick
A periodic tick event for animations or timed updates.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Forget for InputEvent
impl Freeze for InputEvent
impl RefUnwindSafe for InputEvent
impl Send for InputEvent
impl Sync for InputEvent
impl Unpin for InputEvent
impl UnsafeUnpin for InputEvent
impl UnwindSafe for InputEvent
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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