pub struct LogBuffer { /* private fields */ }Expand description
A bounded store of log lines: when full, pushing drops the oldest line.
Cloning is cheap (lines live in shared chunks), so an application keeps one buffer in its
state, pushes lines in update and hands it to a LogView every frame.
Every line gets a number that never changes while it is in the buffer, which lets the view
keep its scroll position and selection while old lines fall out.
Implementations§
Source§impl LogBuffer
impl LogBuffer
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
An empty buffer keeping at most capacity lines (at least one).
Sourcepub fn push(&mut self, line: LogLine)
pub fn push(&mut self, line: LogLine)
Adds a line at the end, dropping the oldest line when full.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LogBuffer
impl RefUnwindSafe for LogBuffer
impl Send for LogBuffer
impl Sync for LogBuffer
impl Unpin for LogBuffer
impl UnsafeUnpin for LogBuffer
impl UnwindSafe for LogBuffer
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,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more