pub enum Event {
Show 13 variants
Synchronize(SynchronizeEvent),
Key(KeyEvent),
Relative(RelativeEvent),
Absolute(AbsoluteEvent),
Switch(SwitchEvent),
Misc(MiscEvent),
Led(LedEvent),
Autorepeat(AutorepeatEvent),
Sound(SoundEvent),
ForceFeedback(ForceFeedbackEvent),
ForceFeedbackStatus(ForceFeedbackStatusEvent),
UInput(UInputEvent),
Unknown(InputEvent),
}
Expand description
An owned and typed input event.
Variants§
Synchronize(SynchronizeEvent)
Key(KeyEvent)
Relative(RelativeEvent)
Absolute(AbsoluteEvent)
Switch(SwitchEvent)
Misc(MiscEvent)
Led(LedEvent)
Autorepeat(AutorepeatEvent)
Sound(SoundEvent)
ForceFeedback(ForceFeedbackEvent)
ForceFeedbackStatus(ForceFeedbackStatusEvent)
UInput(UInputEvent)
Unknown(InputEvent)
Unknown event type.
Implementations§
Source§impl Event
impl Event
Sourcepub fn new(event: InputEvent) -> Result<Self, RangeError>
pub fn new(event: InputEvent) -> Result<Self, RangeError>
Converts a generic InputEvent
to a typed event.
Sourcepub fn with_event(event: InputEvent) -> Self
pub fn with_event(event: InputEvent) -> Self
Converts a generic InputEvent
to a typed event.
Unlike Event::new
this will fall back to Event::Unknown
when an event fails to validate.
Sourcepub fn into_event(self) -> InputEvent
pub fn into_event(self) -> InputEvent
Extracts the contained event.
Sourcepub fn as_event(&self) -> &InputEvent
pub fn as_event(&self) -> &InputEvent
Borrows the event.
Trait Implementations§
Source§impl AsRef<InputEvent> for Event
impl AsRef<InputEvent> for Event
Source§fn as_ref(&self) -> &InputEvent
fn as_ref(&self) -> &InputEvent
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<'de> Deserialize<'de> for Event
impl<'de> Deserialize<'de> for Event
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<AbsoluteEvent> for Event
impl From<AbsoluteEvent> for Event
Source§fn from(event: AbsoluteEvent) -> Self
fn from(event: AbsoluteEvent) -> Self
Converts to this type from the input type.
Source§impl From<AutorepeatEvent> for Event
impl From<AutorepeatEvent> for Event
Source§fn from(event: AutorepeatEvent) -> Self
fn from(event: AutorepeatEvent) -> Self
Converts to this type from the input type.
Source§impl From<Event> for InputEvent
impl From<Event> for InputEvent
Source§impl From<ForceFeedbackEvent> for Event
impl From<ForceFeedbackEvent> for Event
Source§fn from(event: ForceFeedbackEvent) -> Self
fn from(event: ForceFeedbackEvent) -> Self
Converts to this type from the input type.
Source§impl From<ForceFeedbackStatusEvent> for Event
impl From<ForceFeedbackStatusEvent> for Event
Source§fn from(event: ForceFeedbackStatusEvent) -> Self
fn from(event: ForceFeedbackStatusEvent) -> Self
Converts to this type from the input type.
Source§impl From<InputEvent> for Event
impl From<InputEvent> for Event
Source§fn from(event: InputEvent) -> Self
fn from(event: InputEvent) -> Self
Converts to this type from the input type.
Source§impl From<RelativeEvent> for Event
impl From<RelativeEvent> for Event
Source§fn from(event: RelativeEvent) -> Self
fn from(event: RelativeEvent) -> Self
Converts to this type from the input type.
Source§impl From<SoundEvent> for Event
impl From<SoundEvent> for Event
Source§fn from(event: SoundEvent) -> Self
fn from(event: SoundEvent) -> Self
Converts to this type from the input type.
Source§impl From<SwitchEvent> for Event
impl From<SwitchEvent> for Event
Source§fn from(event: SwitchEvent) -> Self
fn from(event: SwitchEvent) -> Self
Converts to this type from the input type.
Source§impl From<SynchronizeEvent> for Event
impl From<SynchronizeEvent> for Event
Source§fn from(event: SynchronizeEvent) -> Self
fn from(event: SynchronizeEvent) -> Self
Converts to this type from the input type.
Source§impl From<UInputEvent> for Event
impl From<UInputEvent> for Event
Source§fn from(event: UInputEvent) -> Self
fn from(event: UInputEvent) -> Self
Converts to this type from the input type.
Source§impl Ord for Event
impl Ord for Event
Source§impl PartialOrd for Event
impl PartialOrd for Event
impl Copy for Event
impl Eq for Event
impl StructuralPartialEq for Event
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
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