#[non_exhaustive]pub struct EventEnvelope { /* private fields */ }Expand description
Runtime event together with host correlation and presentation metadata.
The envelope does not validate that optional pointer metadata corresponds to
an Event::Pointer, or that its logical window/generation is currently
accepted. Routing/presentation orchestration owns those checks. The struct
is non-exhaustive and exposes data through accessors.
§Examples
use std::time::Duration;
use ailloli_ui_core::event::{Event, FocusEvent};
use ailloli_ui_runtime::{app::PresentationGeneration, input::{EventEnvelope, EventId, EventMeta, EventTimestamp}};
let meta = EventMeta::new(EventId::new(1), EventTimestamp::new(Duration::ZERO), "main", PresentationGeneration::INITIAL);
let envelope = EventEnvelope::new(meta, Event::Focus(FocusEvent::new(true)));
assert!(matches!(envelope.event(), Event::Focus(_)));Implementations§
Source§impl EventEnvelope
Provides the operations defined for EventEnvelope.
impl EventEnvelope
Provides the operations defined for EventEnvelope.
Sourcepub const fn new(meta: EventMeta, event: Event) -> Self
pub const fn new(meta: EventMeta, event: Event) -> Self
Combines metadata and an event without cross-validating them.
§Examples
use std::time::Duration;
use ailloli_ui_core::event::{Event, FocusEvent};
use ailloli_ui_runtime::{app::PresentationGeneration, input::{EventEnvelope, EventId, EventMeta, EventTimestamp}};
let meta = EventMeta::new(EventId::new(2), EventTimestamp::new(Duration::ZERO), "main", PresentationGeneration::INITIAL);
let envelope = EventEnvelope::new(meta, Event::Focus(FocusEvent::new(false)));
assert_eq!(envelope.meta().id(), EventId::new(2));Sourcepub const fn meta(&self) -> &EventMeta
pub const fn meta(&self) -> &EventMeta
Borrows host correlation and presentation metadata.
§Examples
use std::time::Duration;
use ailloli_ui_core::event::{Event, FocusEvent};
use ailloli_ui_runtime::{app::PresentationGeneration, input::{EventEnvelope, EventId, EventMeta, EventTimestamp}};
let envelope = EventEnvelope::new(EventMeta::new(EventId::new(7), EventTimestamp::new(Duration::ZERO), "main", PresentationGeneration::INITIAL), Event::Focus(FocusEvent::new(true)));
assert_eq!(envelope.meta().id().get(), 7);Sourcepub const fn event(&self) -> &Event
pub const fn event(&self) -> &Event
Borrows the provider-neutral event payload.
§Examples
use std::time::Duration;
use ailloli_ui_core::event::{Event, FocusEvent};
use ailloli_ui_runtime::{app::PresentationGeneration, input::{EventEnvelope, EventId, EventMeta, EventTimestamp}};
let envelope = EventEnvelope::new(EventMeta::new(EventId::new(1), EventTimestamp::new(Duration::ZERO), "main", PresentationGeneration::INITIAL), Event::Focus(FocusEvent::new(true)));
assert!(matches!(envelope.event(), Event::Focus(event) if event.focused));Sourcepub const fn pointer(&self) -> Option<&PointerSample>
pub const fn pointer(&self) -> Option<&PointerSample>
Pointer sample carried by this envelope, when the event has one.
This delegates to metadata rather than inspecting the event variant.
§Examples
use std::time::Duration;
use ailloli_ui_core::event::{Event, FocusEvent};
use ailloli_ui_runtime::{app::PresentationGeneration, input::{EventEnvelope, EventId, EventMeta, EventTimestamp}};
let envelope = EventEnvelope::new(EventMeta::new(EventId::new(1), EventTimestamp::new(Duration::ZERO), "main", PresentationGeneration::INITIAL), Event::Focus(FocusEvent::new(true)));
assert_eq!(envelope.pointer(), None);Sourcepub const fn pointer_is_primary(&self) -> Option<bool>
pub const fn pointer_is_primary(&self) -> Option<bool>
Returns the envelope’s explicit primary-pointer classification.
None means no sample was attached, not a secondary pointer.
§Examples
use std::time::Duration;
use ailloli_ui_core::event::{Event, FocusEvent};
use ailloli_ui_runtime::{app::PresentationGeneration, input::{EventEnvelope, EventId, EventMeta, EventTimestamp}};
let envelope = EventEnvelope::new(EventMeta::new(EventId::new(1), EventTimestamp::new(Duration::ZERO), "main", PresentationGeneration::INITIAL), Event::Focus(FocusEvent::new(true)));
assert_eq!(envelope.pointer_is_primary(), None);Sourcepub fn into_parts(self) -> (EventMeta, Event)
pub fn into_parts(self) -> (EventMeta, Event)
Consumes the envelope and returns (metadata, event) without cloning.
§Examples
use std::time::Duration;
use ailloli_ui_core::event::{Event, FocusEvent};
use ailloli_ui_runtime::{app::PresentationGeneration, input::{EventEnvelope, EventId, EventMeta, EventTimestamp}};
let envelope = EventEnvelope::new(EventMeta::new(EventId::new(5), EventTimestamp::new(Duration::ZERO), "main", PresentationGeneration::INITIAL), Event::Focus(FocusEvent::new(true)));
let (meta, event) = envelope.into_parts();
assert_eq!(meta.id().get(), 5);
assert!(matches!(event, Event::Focus(_)));Trait Implementations§
Source§impl Clone for EventEnvelope
impl Clone for EventEnvelope
Source§fn clone(&self) -> EventEnvelope
fn clone(&self) -> EventEnvelope
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EventEnvelope
impl Debug for EventEnvelope
Source§impl PartialEq for EventEnvelope
impl PartialEq for EventEnvelope
impl StructuralPartialEq for EventEnvelope
Auto Trait Implementations§
impl Freeze for EventEnvelope
impl RefUnwindSafe for EventEnvelope
impl Send for EventEnvelope
impl Sync for EventEnvelope
impl Unpin for EventEnvelope
impl UnwindSafe for EventEnvelope
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§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
Source§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.