Skip to main content

Event

Enum Event 

Source
pub enum Event {
Show 20 variants PointerDown { target: u32, x: f32, y: f32, secondary: bool, }, PointerMove { target: u32, x: f32, y: f32, hovering: bool, leaving: bool, }, PointerUp { target: u32, x: f32, y: f32, secondary: bool, }, KeyDown { target: u32, key_code: u16, modifiers: u8, repeat: bool, }, KeyUp { target: u32, key_code: u16, modifiers: u8, }, ValueChanged { target: u32, value: f32, }, TextChanged { target: u32, value: String, }, FocusChanged { target: u32, focused: bool, }, EditingChanged { target: u32, editing: bool, }, Submit { target: u32, }, Scroll { target: u32, offset_x: f32, offset_y: f32, }, Wheel { target: u32, delta_x: f32, delta_y: f32, }, DateChanged { target: u32, days: i32, millis: u32, }, Navigate { url: Option<String>, }, MediaPlayStateChanged { target: u32, playing: bool, }, MediaTimeUpdated { target: u32, seconds: f32, }, MediaEnded { target: u32, }, MediaVolumeChanged { target: u32, volume: f32, }, MediaDurationChanged { target: u32, seconds: f32, }, FitChanged { target: u32, index: f32, },
}
Expand description

A raw-input event (host → guest).

Event is not Copy: Event::TextChanged owns the new field text and Event::Navigate owns an optional URL. Simple events round-trip through encode/try_from as pure 16-byte opcodes; TextChanged and Navigate with a URL are encoded/decoded at the batch level (their strings live in the string section / event arena, referenced by a relative/absolute offset).

Variants§

§

PointerDown

Pointer button pressed at a viewport-relative point.

Fields

§target: u32
§secondary: bool
§

PointerMove

Pointer moved; optionally entered/left the node (hover).

Fields

§target: u32
§hovering: bool
§leaving: bool
§

PointerUp

Pointer button released at a viewport-relative point.

Fields

§target: u32
§secondary: bool
§

KeyDown

Key pressed (possibly an auto-repeat).

Fields

§target: u32
§key_code: u16
§modifiers: u8
§repeat: bool
§

KeyUp

Key released.

Fields

§target: u32
§key_code: u16
§modifiers: u8
§

ValueChanged

A control’s value changed (host → guest). The renderer resolves the semantic value (e.g. a slider thumb dragged along its track) and reports it here; the guest/app writes it into its bound state.

Fields

§target: u32
§value: f32
§

TextChanged

A text field’s value changed (host → guest). The new text is resolved from the batch’s string section (see the doc comment on this enum).

Fields

§target: u32
§value: String
§

FocusChanged

A node gained/lost focus (host → guest). Draft command 0x08.

Fields

§target: u32
§focused: bool
§

EditingChanged

An editing session began/ended (host → guest). Draft command 0x09.

Fields

§target: u32
§editing: bool
§

Submit

The user committed a field (host → guest). Draft command 0x0A.

Fields

§target: u32
§

Scroll

A scroll container’s offset changed (host → guest). Draft command 0x0B.

Fields

§target: u32
§offset_x: f32
§offset_y: f32
§

Wheel

Raw wheel/trackpad deltas (host → guest). Draft command 0x0C.

Fields

§target: u32
§delta_x: f32
§delta_y: f32
§

DateChanged

A DATE_PICKER’s value changed (host → guest). Draft command 0x0D; days is I32 (pre-1970 negative), millis is millis of day.

Fields

§target: u32
§days: i32
§millis: u32
§

Navigate

A global navigation request (host → guest). Draft command 0x0E; never node-keyed. url: Some(...) carries the destination URL the platform navigated to (browser popstate/back/forward/deep-link), resolved from the string section / event arena; url: None is a native back request.

Fields

§

MediaPlayStateChanged

A bound MEDIA_CONTROLLER’s playback state changed (host → guest). Draft command 0x0F; reported only when PLAYBACK_STATE is bound.

Fields

§target: u32
§playing: bool
§

MediaTimeUpdated

A bound controller’s current playback position (host → guest). Draft command 0x10; seconds is the position in seconds (f32), reported while playing. An app-initiated seek (MEDIA_POSITION change) is not echoed.

Fields

§target: u32
§seconds: f32
§

MediaEnded

A bound controller reached the end of its media (host → guest). Draft command 0x11.

Fields

§target: u32
§

MediaVolumeChanged

A bound controller’s volume changed (host → guest). Draft command 0x12; volume is in the range 0..1 (f32).

Fields

§target: u32
§volume: f32
§

MediaDurationChanged

A bound controller’s media duration became known/changed (host → guest). Draft command 0x14; seconds is the duration (f32). Reported when the resource loads and only when the value changes.

Fields

§target: u32
§seconds: f32
§

FitChanged

A SIZE_THAT_FITS slot’s selected candidate changed (host → guest). Draft command 0x13; index is the derived fit index (f32), reported once after the first measure and then only when it changes.

Fields

§target: u32
§index: f32

Implementations§

Source§

impl Event

Source

pub fn encode(&self) -> Opcode

Encode this event as a 16-byte opcode.

TextChanged and Navigate with a URL cannot be fully encoded here — their strings live in the batch’s string section / event arena — so this emits the opcode with a zero B offset; the batch-aware encode_events/decode_events pair in pathland-core-transport writes the string and its real offset.

Trait Implementations§

Source§

impl Clone for Event

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Event

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Event

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Event

Source§

impl TryFrom<Opcode> for Event

Source§

type Error = EventError

The type returned in the event of a conversion error.
Source§

fn try_from(op: Opcode) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl Forget for Event

§

impl Freeze for Event

§

impl Move for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnsafeUnpin for Event

§

impl UnwindSafe for Event

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.