#[repr(u32)]pub enum KeyEventType {
Pressed = 1,
Released = 2,
Sync = 3,
Cancel = 4,
}
Expand description
Type of the keyboard key input event.
We do not expect new values to be added into this enum.
Variants§
Pressed = 1
Key is actuated.
Receiving this event type means that a key has been actuated at the timestamp when the event is received, and while the event recipient is focused.
For example, if the key is a keyboard key, then it was just pressed.
Released = 2
Key is no longer actuated.
Receiving this event type means that a key has been de-actuated at the timestamp when the event is received, and while the event recipient is focused.
For example, if the key is a keyboard key, then it was just released.
Sync = 3
Key was actuated while the client wasn’t able to receive it, and is still actuated now that the client is able to receive key events.
This may happen in a few ways:
- A new device was connected while its key was actuated.
- The key was actuated while the event recipient did not have focus.
Therefore, this is not a “regular” key actuation. It reports now that the key has been actuated in the unknown past. Some event recipients may therefore decide that this is not an actionable key event, while some others may decide that it is.
For example, recipients that trigger some user action may
decide to ignore SYNC
events, to avoid spurious actions. In
contrast, recipients that keep track of the keyboard
state may want to consider a SYNC
event as a signal
to update the key’s state to actuated.
Cancel = 4
Key may have been actuated, but its actuation has become invalid due to an event other than a key de-actuation.
This may happen in a few ways:
- A device was disconnected while its key was actuated.
- The event recipient just lost focus.
Therefore, this is not a “regular” key de-actuation. It reports the key is no longer validly actuated due to an event other than a key release. Some event recipients may therefore decide that this is not an actionable key event, while some others may decide that it is.
For example, recipients which trigger some user action may
decide to ignore CANCEL
events, to avoid spurious actions. In
contrast, recipients that keep track of the keyboard
state may want to consider a CANCEL
event as a signal to update
the key’s state to being de-actuated.
Implementations§
source§impl KeyEventType
impl KeyEventType
pub fn from_primitive(prim: u32) -> Option<Self>
pub const fn into_primitive(self) -> u32
pub fn is_unknown(&self) -> bool
is_unknown
Trait Implementations§
source§impl Clone for KeyEventType
impl Clone for KeyEventType
source§fn clone(&self) -> KeyEventType
fn clone(&self) -> KeyEventType
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for KeyEventType
impl Debug for KeyEventType
source§impl Decode<KeyEventType> for KeyEventType
impl Decode<KeyEventType> for KeyEventType
source§impl Encode<KeyEventType> for KeyEventType
impl Encode<KeyEventType> for KeyEventType
source§impl Hash for KeyEventType
impl Hash for KeyEventType
source§impl Ord for KeyEventType
impl Ord for KeyEventType
source§fn cmp(&self, other: &KeyEventType) -> Ordering
fn cmp(&self, other: &KeyEventType) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for KeyEventType
impl PartialEq for KeyEventType
source§fn eq(&self, other: &KeyEventType) -> bool
fn eq(&self, other: &KeyEventType) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for KeyEventType
impl PartialOrd for KeyEventType
source§fn partial_cmp(&self, other: &KeyEventType) -> Option<Ordering>
fn partial_cmp(&self, other: &KeyEventType) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl TypeMarker for KeyEventType
impl TypeMarker for KeyEventType
§type Owned = KeyEventType
type Owned = KeyEventType
source§fn inline_align(_context: Context) -> usize
fn inline_align(_context: Context) -> usize
source§fn inline_size(_context: Context) -> usize
fn inline_size(_context: Context) -> usize
inline_align
.source§fn encode_is_copy() -> bool
fn encode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and encoding requires no validation. When true, we can optimize
encoding arrays and vectors of Self::Owned
to a single memcpy. Read moresource§fn decode_is_copy() -> bool
fn decode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and decoding requires no validation. When true, we can optimize
decoding arrays and vectors of Self::Owned
to a single memcpy.source§impl ValueTypeMarker for KeyEventType
impl ValueTypeMarker for KeyEventType
§type Borrowed<'a> = KeyEventType
type Borrowed<'a> = KeyEventType
Encode<Self>
type cheaply obtainable from &Self::Owned
. There are three cases: Read moreimpl Copy for KeyEventType
impl Eq for KeyEventType
impl StructuralPartialEq for KeyEventType
Auto Trait Implementations§
impl Freeze for KeyEventType
impl RefUnwindSafe for KeyEventType
impl Send for KeyEventType
impl Sync for KeyEventType
impl Unpin for KeyEventType
impl UnwindSafe for KeyEventType
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)