pub struct RichLogState {
pub entries: Vec<RichLogEntry>,
pub auto_scroll: bool,
pub max_entries: Option<usize>,
/* private fields */
}Expand description
State for the rich log viewer widget.
Fields§
§entries: Vec<RichLogEntry>Log entries to display.
auto_scroll: boolWhether to auto-scroll to bottom when new entries are added.
max_entries: Option<usize>Maximum number of entries to keep (None = unlimited).
Implementations§
Source§impl RichLogState
impl RichLogState
Sourcepub const DEFAULT_MAX_ENTRIES: usize = 10_000
pub const DEFAULT_MAX_ENTRIES: usize = 10_000
Default maximum entry cap used by RichLogState::new.
Long-running apps that push log entries continuously would otherwise
accumulate state without bound. Use RichLogState::new_unbounded to
opt out explicitly.
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty rich log state with the default entry cap
(Self::DEFAULT_MAX_ENTRIES).
Sourcepub fn new_unbounded() -> Self
pub fn new_unbounded() -> Self
Create an empty rich log state without an entry cap.
Prefer RichLogState::new in long-running apps. Use this constructor
only when the host explicitly bounds growth elsewhere.
Sourcepub fn push(&mut self, text: impl Into<String>, style: Style)
pub fn push(&mut self, text: impl Into<String>, style: Style)
Add a single-style entry to the log.
Sourcepub fn push_plain(&mut self, text: impl Into<String>)
pub fn push_plain(&mut self, text: impl Into<String>)
Add a plain text entry using default style.
Sourcepub fn push_segments(&mut self, segments: Vec<(String, Style)>)
pub fn push_segments(&mut self, segments: Vec<(String, Style)>)
Add a multi-segment styled entry to the log.
Trait Implementations§
Source§impl Clone for RichLogState
impl Clone for RichLogState
Source§fn clone(&self) -> RichLogState
fn clone(&self) -> RichLogState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more