Struct input_linux::KeyEvent
source · #[repr(C)]pub struct KeyEvent {
pub time: EventTime,
pub key: Key,
pub value: KeyState,
/* private fields */
}
Expand description
An event that indicates the state of a key has changed.
Fields§
§time: EventTime
The timestamp associated with the event.
key: Key
The key that triggered the event.
value: KeyState
The value of the event.
Implementations§
source§impl<'a> KeyEvent
impl<'a> KeyEvent
sourcepub const fn new(time: EventTime, key: Key, value: KeyState) -> Self
pub const fn new(time: EventTime, key: Key, value: KeyState) -> Self
Creates a new event from the given code and value.
sourcepub unsafe fn from_event<E: AsRef<input_event>>(event: &E) -> &Self
pub unsafe fn from_event<E: AsRef<input_event>>(event: &E) -> &Self
Reinterpret a generic event without checking for validity.
sourcepub unsafe fn from_event_mut(event: &mut InputEvent) -> &mut Self
pub unsafe fn from_event_mut(event: &mut InputEvent) -> &mut Self
Reinterpret a mutable generic event without checking for validity.
sourcepub fn as_event(&self) -> &InputEvent
pub fn as_event(&self) -> &InputEvent
A generic input event reference.
sourcepub unsafe fn as_event_mut(&mut self) -> &mut InputEvent
pub unsafe fn as_event_mut(&mut self) -> &mut InputEvent
A mutable generic input event reference.
Trait Implementations§
source§impl AsRef<InputEvent> for KeyEvent
impl AsRef<InputEvent> for KeyEvent
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 KeyEvent
impl<'de> Deserialize<'de> for KeyEvent
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<'a> From<&'a KeyEvent> for &'a InputEvent
impl<'a> From<&'a KeyEvent> for &'a InputEvent
source§impl<'a> From<&'a KeyEvent> for InputEvent
impl<'a> From<&'a KeyEvent> for InputEvent
source§impl From<KeyEvent> for InputEvent
impl From<KeyEvent> for InputEvent
source§impl GenericEvent for KeyEvent
impl GenericEvent for KeyEvent
source§fn event_kind(&self) -> EventKind
fn event_kind(&self) -> EventKind
The event kind.
source§fn from_ref(event: &InputEvent) -> Result<&Self, RangeError>
fn from_ref(event: &InputEvent) -> Result<&Self, RangeError>
Interprets a generic event reference into a concrete event type.
source§fn from_mut(event: &mut InputEvent) -> Result<&mut Self, RangeError>
fn from_mut(event: &mut InputEvent) -> Result<&mut Self, RangeError>
Interprets a mutable generic event reference into a concrete event type.
source§impl Ord for KeyEvent
impl Ord for KeyEvent
source§impl PartialEq<KeyEvent> for KeyEvent
impl PartialEq<KeyEvent> for KeyEvent
source§impl PartialOrd<KeyEvent> for KeyEvent
impl PartialOrd<KeyEvent> for KeyEvent
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<'a> TryFrom<&'a InputEvent> for &'a KeyEvent
impl<'a> TryFrom<&'a InputEvent> for &'a KeyEvent
§type Error = RangeError
type Error = RangeError
The type returned in the event of a conversion error.
source§impl<'a> TryFrom<&'a mut InputEvent> for &'a mut KeyEvent
impl<'a> TryFrom<&'a mut InputEvent> for &'a mut KeyEvent
§type Error = RangeError
type Error = RangeError
The type returned in the event of a conversion error.
source§impl TryFrom<InputEvent> for KeyEvent
impl TryFrom<InputEvent> for KeyEvent
§type Error = RangeError
type Error = RangeError
The type returned in the event of a conversion error.