Enum EventPhase
#[repr(u32)]pub enum EventPhase {
Add = 1,
Change = 2,
Remove = 3,
Cancel = 4,
}
Expand description
The possible states of a pointer event. These phases of events in a stream
follow a state machine that starts with the ADD
phase, followed by zero or
more CHANGE
phases, and finally terminates with REMOVE
or CANCEL
phase.
ADD ---> CHANGE* -+-> REMOVE
|
+-> CANCEL
A finite sequence of pointer events that follows this state machine, starting from the initial state, is called an interaction. A closed (or past) interaction is one where it has reached the terminal state; an open (or current) interaction is one where it has not.
For a given device pointer, a stream of events is observed as a succession of zero or more closed interactions (the past history of user engagement), followed by at most one open interaction (the current user engagement).
When we need to group pointer events by their interaction, an event carries an interaction id that is unique in that pointer stream. This common reference makes it possible to operate on a closed interaction, as well as an open interaction.
For example, touch events are typically observed as a succession of interactions, as fingers engage and disengage with the display.
Variants§
Add = 1
The device has started tracking the pointer.
Change = 2
The device has reported an update to the pointer state.
Remove = 3
The device has stopped tracking the pointer.
Cancel = 4
The pointer is no longer available.
Implementations§
§impl EventPhase
impl EventPhase
pub fn from_primitive(prim: u32) -> Option<EventPhase>
pub const fn into_primitive(self) -> u32
pub fn is_unknown(&self) -> bool
is_unknown
Trait Implementations§
§impl Clone for EventPhase
impl Clone for EventPhase
§fn clone(&self) -> EventPhase
fn clone(&self) -> EventPhase
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for EventPhase
impl Debug for EventPhase
§impl<D> Decode<EventPhase, D> for EventPhasewhere
D: ResourceDialect,
impl<D> Decode<EventPhase, D> for EventPhasewhere
D: ResourceDialect,
§fn new_empty() -> EventPhase
fn new_empty() -> EventPhase
Self
. The specific value does not matter,
since it will be overwritten by decode
.§impl<D> Encode<EventPhase, D> for EventPhasewhere
D: ResourceDialect,
impl<D> Encode<EventPhase, D> for EventPhasewhere
D: ResourceDialect,
§impl Hash for EventPhase
impl Hash for EventPhase
§impl Ord for EventPhase
impl Ord for EventPhase
§impl PartialEq for EventPhase
impl PartialEq for EventPhase
§impl PartialOrd for EventPhase
impl PartialOrd for EventPhase
§impl TypeMarker for EventPhase
impl TypeMarker for EventPhase
§type Owned = EventPhase
type Owned = EventPhase
§fn inline_align(_context: Context) -> usize
fn inline_align(_context: Context) -> usize
§fn inline_size(_context: Context) -> usize
fn inline_size(_context: Context) -> usize
inline_align
.§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 more§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.§impl ValueTypeMarker for EventPhase
impl ValueTypeMarker for EventPhase
§type Borrowed<'a> = EventPhase
type Borrowed<'a> = EventPhase
Encode<Self>
type cheaply obtainable from &Self::Owned
. There are three cases: Read more§fn borrow(
value: &<EventPhase as TypeMarker>::Owned,
) -> <EventPhase as ValueTypeMarker>::Borrowed<'_>
fn borrow( value: &<EventPhase as TypeMarker>::Owned, ) -> <EventPhase as ValueTypeMarker>::Borrowed<'_>
&Self::Owned
to Self::Borrowed
.