pub struct NullSink;Expand description
Discard sink: accepts every record and drops it. Use this when
the test or production stack needs the runtime composition to
match LoggingResource(...) shape but does not need to
retain log records.
InMemorySink keeps every record alive for as long as the sink
(and therefore the wrapping LoggingResource) lives. In long-
running stress loops that compose
LoggingResource(InMemorySink) once and reuse it across many
iterations, that buffer grows unbounded — measurable memory and
CPU overhead even if no test reads the records.
NullSink solves that by discarding the record without
allocating; the decorator still constructs the LogRecord
(one stack-allocated value per call), but no per-record retention
occurs.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NullSink
impl RefUnwindSafe for NullSink
impl Send for NullSink
impl Sync for NullSink
impl Unpin for NullSink
impl UnsafeUnpin for NullSink
impl UnwindSafe for NullSink
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