pub struct WebEventSource { /* private fields */ }Expand description
Host-driven event source for WASM.
The host is responsible for pushing Event values and updating size.
Implementations§
Source§impl WebEventSource
impl WebEventSource
Sourcepub const MAX_EVENTS: usize = 4096
pub const MAX_EVENTS: usize = 4096
Maximum pending events. Accepted input is never evicted to admit new input.
Sourcepub const MAX_PAYLOAD_BYTES: usize
pub const MAX_PAYLOAD_BYTES: usize
Maximum retained payload allocation bytes (including String spare capacity).
Sourcepub const fn features(&self) -> BackendFeatures
pub const fn features(&self) -> BackendFeatures
Read back the currently requested backend features.
Sourcepub fn push_event(&mut self, event: Event) -> Result<(), WebBackendError>
pub fn push_event(&mut self, event: Event) -> Result<(), WebBackendError>
Admit a canonical event without evicting previously accepted input.
On overflow, returns the rejected event. Drain pending events before retrying; an oversized individual payload must be rejected by the host.
Sourcepub fn queued_events(&self) -> usize
pub fn queued_events(&self) -> usize
Number of pending accepted events.
Sourcepub const fn queued_payload_bytes(&self) -> usize
pub const fn queued_payload_bytes(&self) -> usize
Total allocation bytes retained by pending text payloads.
Sourcepub fn drain_events(&mut self) -> impl Iterator<Item = Event> + '_
pub fn drain_events(&mut self) -> impl Iterator<Item = Event> + '_
Drain pending events in FIFO order. Dropping the iterator early leaves unconsumed input queued for the next drain or read.
Trait Implementations§
Source§impl BackendEventSource for WebEventSource
impl BackendEventSource for WebEventSource
Source§type Error = WebBackendError
type Error = WebBackendError
Platform-specific error type.
Source§fn size(&self) -> Result<(u16, u16), Self::Error>
fn size(&self) -> Result<(u16, u16), Self::Error>
Query current terminal dimensions (columns, rows).
Source§fn set_features(&mut self, features: BackendFeatures) -> Result<(), Self::Error>
fn set_features(&mut self, features: BackendFeatures) -> Result<(), Self::Error>
Enable or disable terminal features (mouse, paste, focus, kitty keyboard). Read more
Source§fn poll_event(&mut self, timeout: Duration) -> Result<bool, Self::Error>
fn poll_event(&mut self, timeout: Duration) -> Result<bool, Self::Error>
Poll for an available event, returning
true if one is ready. Read moreSource§fn read_event(&mut self) -> Result<Option<Event>, Self::Error>
fn read_event(&mut self) -> Result<Option<Event>, Self::Error>
Read the next available event, or
None if none is ready. Read moreSource§fn supports_suspend(&self) -> bool
fn supports_suspend(&self) -> bool
Whether
suspend can hand the terminal back for a
job-control stop. The runtime claims SIGTSTP/SIGTTIN/SIGTTOU only for a
source that says so; others keep the signals’ default action.Source§impl Clone for WebEventSource
impl Clone for WebEventSource
Auto Trait Implementations§
impl Freeze for WebEventSource
impl RefUnwindSafe for WebEventSource
impl Send for WebEventSource
impl Sync for WebEventSource
impl Unpin for WebEventSource
impl UnsafeUnpin for WebEventSource
impl UnwindSafe for WebEventSource
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
Mutably borrows from an owned value. Read more