pub struct LogRing { /* private fields */ }Expand description
Bounded ring of log records. Append-only; oldest is evicted when capacity is reached.
Implementations§
Source§impl LogRing
impl LogRing
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Construct with capacity. capacity of 0 produces a ring
that drops everything (useful for “logging disabled”).
pub fn is_empty(&self) -> bool
Sourcepub fn snapshot(&self) -> Vec<LogRecord>
pub fn snapshot(&self) -> Vec<LogRecord>
Snapshot every record. Cheap clone (each LogRecord’s
heavy field is the message String; we’re optimising
for correctness here, not for log-view paint cost).
Sourcepub fn set_capacity(&mut self, capacity: usize)
pub fn set_capacity(&mut self, capacity: usize)
Capacity setter. Used when the user adjusts
lsp.log_capacity at runtime.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LogRing
impl RefUnwindSafe for LogRing
impl Send for LogRing
impl Sync for LogRing
impl Unpin for LogRing
impl UnsafeUnpin for LogRing
impl UnwindSafe for LogRing
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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