#[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<D: ResourceDialect> Decode<KeyEventType, D> for KeyEventType
impl<D: ResourceDialect> Decode<KeyEventType, D> for KeyEventType
Source§impl<D: ResourceDialect> Encode<KeyEventType, D> for KeyEventType
impl<D: ResourceDialect> Encode<KeyEventType, D> 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§impl PartialOrd for KeyEventType
impl PartialOrd for KeyEventType
Source§impl TypeMarker for KeyEventType
impl TypeMarker for KeyEventType
Source§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
Source§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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)