pub struct TerminalEvent {
pub sequence: u64,
pub timestamp_ms: Option<i64>,
pub kind: TerminalEventKind,
}Expand description
Sequenced terminal-buffer mutation with optional timestamp metadata.
Sequence numbers are retained for clients but events are applied in supplied order without sorting or duplicate rejection.
§Examples
use ailloli_ui_widgets::controls::{TerminalEvent, TerminalEventKind};
let event = TerminalEvent::clear(9);
assert_eq!(event.sequence, 9);
assert!(matches!(event.kind, TerminalEventKind::Clear));Fields§
§sequence: u64Caller-assigned sequence metadata.
timestamp_ms: Option<i64>Optional timestamp inherited by appended lines/chunks where applicable.
kind: TerminalEventKindBuffer mutation payload.
Implementations§
Source§impl TerminalEvent
impl TerminalEvent
Sourcepub fn new(sequence: u64, kind: TerminalEventKind) -> Self
pub fn new(sequence: u64, kind: TerminalEventKind) -> Self
Creates an untimestamped event with the supplied sequence metadata.
§Examples
use ailloli_ui_widgets::controls::{TerminalEvent, TerminalEventKind};
let event = TerminalEvent::new(1, TerminalEventKind::Clear);
assert_eq!(event.timestamp_ms, None);Sourcepub fn append_line(sequence: u64, line: TerminalLine) -> Self
pub fn append_line(sequence: u64, line: TerminalLine) -> Self
Creates a complete-line append event.
§Examples
use ailloli_ui_widgets::controls::{TerminalEvent, TerminalEventKind, TerminalLine};
let event = TerminalEvent::append_line(2, TerminalLine::new("done"));
assert!(matches!(event.kind, TerminalEventKind::AppendLine(_)));Sourcepub fn stdout_chunk(sequence: u64, text: impl Into<String>) -> Self
pub fn stdout_chunk(sequence: u64, text: impl Into<String>) -> Self
Creates a streaming stdout chunk event.
§Examples
use ailloli_ui_widgets::controls::{TerminalEvent, TerminalEventKind};
let event = TerminalEvent::stdout_chunk(3, "one\ntwo");
assert!(matches!(event.kind, TerminalEventKind::StdoutChunk(_)));Sourcepub fn stderr_chunk(sequence: u64, text: impl Into<String>) -> Self
pub fn stderr_chunk(sequence: u64, text: impl Into<String>) -> Self
Creates a streaming stderr chunk event.
§Examples
use ailloli_ui_widgets::controls::{TerminalEvent, TerminalEventKind};
let event = TerminalEvent::stderr_chunk(4, "warning");
assert!(matches!(event.kind, TerminalEventKind::StderrChunk(_)));Sourcepub fn status(sequence: u64, text: impl Into<String>) -> Self
pub fn status(sequence: u64, text: impl Into<String>) -> Self
Creates a system-status event.
§Examples
use ailloli_ui_widgets::controls::{TerminalEvent, TerminalEventKind};
let event = TerminalEvent::status(5, "connected");
assert!(matches!(event.kind, TerminalEventKind::Status(_)));Sourcepub fn clear(sequence: u64) -> Self
pub fn clear(sequence: u64) -> Self
Creates an event that clears complete and partial lines.
§Examples
use ailloli_ui_widgets::controls::{TerminalEvent, TerminalEventKind};
assert!(matches!(TerminalEvent::clear(6).kind, TerminalEventKind::Clear));Sourcepub fn timestamp_ms(self, timestamp_ms: i64) -> Self
pub fn timestamp_ms(self, timestamp_ms: i64) -> Self
Sets caller-defined millisecond timestamp metadata.
§Examples
use ailloli_ui_widgets::controls::TerminalEvent;
assert_eq!(TerminalEvent::clear(1).timestamp_ms(42).timestamp_ms, Some(42));Trait Implementations§
Source§impl Clone for TerminalEvent
impl Clone for TerminalEvent
Source§fn clone(&self) -> TerminalEvent
fn clone(&self) -> TerminalEvent
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TerminalEvent
impl Debug for TerminalEvent
Source§impl PartialEq for TerminalEvent
impl PartialEq for TerminalEvent
impl StructuralPartialEq for TerminalEvent
Auto Trait Implementations§
impl Freeze for TerminalEvent
impl RefUnwindSafe for TerminalEvent
impl Send for TerminalEvent
impl Sync for TerminalEvent
impl Unpin for TerminalEvent
impl UnwindSafe for TerminalEvent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.