Skip to main content

InboundEvent

Struct InboundEvent 

Source
pub struct InboundEvent {
    pub timestamp_ns: u64,
    pub source_id: String,
    pub kind: EventKind,
    pub payload: EventPayload,
    pub capability_lease: Option<u64>,
    pub span: Span,
}
Expand description

An inbound event record — the structured ABI for HID/sensor data.

Every inbound event has:

  • A timestamp (nanoseconds, monotonic or Unix).
  • A source ID (which device/sensor produced this event).
  • An event kind (pointer, keyboard, touch, etc.).
  • A payload (inline data or fat buffer reference).
  • An optional capability lease ID (for biosignals and other capability-leased sources).

Fields§

§timestamp_ns: u64

Timestamp in nanoseconds (monotonic or Unix, depending on source).

§source_id: String

Source device/sensor ID (e.g. “mouse:0”, “keyboard:0”, “eeg:0”).

§kind: EventKind

The kind of event.

§payload: EventPayload

The event payload (inline or fat buffer).

§capability_lease: Option<u64>

Optional capability lease ID (for biosignals and other leased sources).

§span: Span

The span where this event was triggered (if from VibeScript).

Implementations§

Source§

impl InboundEvent

Source

pub fn new( timestamp_ns: u64, source_id: &str, kind: EventKind, payload: EventPayload, ) -> Self

Create a new inbound event.

Source

pub fn with_lease(self, lease_id: u64) -> Self

Set the capability lease ID.

Source

pub fn with_span(self, span: Span) -> Self

Set the span.

Source

pub fn to_value(&self) -> Value

Convert to a VibeScript Record value.

Source

pub fn pointer_move(timestamp_ns: u64, source_id: &str, x: f64, y: f64) -> Self

Create a pointer move event.

Source

pub fn pointer_button( timestamp_ns: u64, source_id: &str, x: f64, y: f64, button: i64, pressed: bool, ) -> Self

Create a pointer button event.

Source

pub fn keyboard( timestamp_ns: u64, source_id: &str, key_code: i64, pressed: bool, ) -> Self

Create a keyboard event.

Source

pub fn touch( timestamp_ns: u64, source_id: &str, touch_id: i64, x: f64, y: f64, phase: &str, ) -> Self

Create a touch event.

Source

pub fn biosignal( timestamp_ns: u64, source_id: &str, iri: &str, hash: u64, lease_id: u64, ) -> Self

Create a biosignal event (with capability lease).

Source

pub fn depth(timestamp_ns: u64, source_id: &str, iri: &str, hash: u64) -> Self

Create a depth map event (fat buffer).

Source

pub fn sip_and_puff( timestamp_ns: u64, source_id: &str, strength: f64, duration_ms: u64, ) -> Self

Create a sip-and-puff event (assistive input). strength is 0.0–1.0 (no puff → hard puff). duration_ms is the duration of the sip/puff in milliseconds.

Source

pub fn switch_event( timestamp_ns: u64, source_id: &str, switch_id: i64, pressed: bool, ) -> Self

Create a switch event (assistive input — single switch, binary).

Source

pub fn braille_chord(timestamp_ns: u64, source_id: &str, dots: u8) -> Self

Create a Braille chord event (assistive input). dots is a bitmask of the 8 Braille dots (bits 0–7).

Source

pub fn eye_gaze( timestamp_ns: u64, source_id: &str, x: f64, y: f64, fixation_ms: u64, ) -> Self

Create an eye-gaze event (assistive input — eye tracking).

Source

pub fn gamepad( timestamp_ns: u64, source_id: &str, buttons: u32, axes: &[f64], ) -> Self

Create a Gamepad event (buttons + axes).

Source

pub fn spatial_head( timestamp_ns: u64, source_id: &str, pos: [f64; 3], ori: [f64; 4], ) -> Self

Create a 6-DoF Spatial Head pose event.

Source

pub fn spatial_hand( timestamp_ns: u64, source_id: &str, is_left: bool, joint_asset_iri: &str, joint_asset_hash: u64, pinch_confidence: f64, ) -> Self

Create a 26-joint Spatial Hand skeleton tracking event.

Source

pub fn spatial_gaze( timestamp_ns: u64, source_id: &str, origin: [f64; 3], direction: [f64; 3], pupil_dia_mm: f64, ) -> Self

Create a Spatial Gaze tracking ray event.

Source

pub fn midi( timestamp_ns: u64, source_id: &str, status: u8, data1: u8, data2: u8, ) -> Self

Create a MIDI controller message event.

Source

pub fn haptic( timestamp_ns: u64, source_id: &str, pattern: &str, intensity: f64, duration_ms: f64, ) -> Self

Create a Haptic actuation event.

Trait Implementations§

Source§

impl Clone for InboundEvent

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 InboundEvent

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,