pub enum Event<T> {
Input(Event),
Key {
keymap_index: u16,
key_event: T,
},
}
Expand description
Events which are either input, or for a particular Key::Event.
It’s useful for Key implementations to use Event with Key::Event, and map Key::Event to and partially from composite::Event.
Variants§
Input(Event)
Keymap input events, such as physical key presses.
Key
Key implementation specific events.
Fields
§
key_event: T
A Key::Event event.
Implementations§
Source§impl<T: Copy> Event<T>
impl<T: Copy> Event<T>
Sourcepub fn key_event(keymap_index: u16, key_event: T) -> Self
pub fn key_event(keymap_index: u16, key_event: T) -> Self
Constructs an Event from an Key::Event.
Sourcepub fn map_key_event<U>(&self, f: fn(_: T) -> U) -> Event<U>
pub fn map_key_event<U>(&self, f: fn(_: T) -> U) -> Event<U>
Maps the Event into a new type.
Sourcepub fn into_key_event<U>(&self) -> Event<U>where
T: Into<U>,
pub fn into_key_event<U>(&self) -> Event<U>where
T: Into<U>,
Maps the Event into a new type.
Sourcepub fn try_into_key_event<U, E>(
&self,
f: fn(_: T) -> Result<U, E>,
) -> Result<Event<U>, EventError>
pub fn try_into_key_event<U, E>( &self, f: fn(_: T) -> Result<U, E>, ) -> Result<Event<U>, EventError>
Maps the Event into a new type.
Trait Implementations§
impl<T: Copy> Copy for Event<T>
impl<T: Eq> Eq for Event<T>
impl<T> StructuralPartialEq for Event<T>
Auto Trait Implementations§
impl<T> Freeze for Event<T>where
T: Freeze,
impl<T> RefUnwindSafe for Event<T>where
T: RefUnwindSafe,
impl<T> Send for Event<T>where
T: Send,
impl<T> Sync for Event<T>where
T: Sync,
impl<T> Unpin for Event<T>where
T: Unpin,
impl<T> UnwindSafe for Event<T>where
T: 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
Mutably borrows from an owned value. Read more