pub struct DiagnosticCapture { /* private fields */ }Expand description
Buffered tracing-event collector for the current thread.
Construct with Self::install; access events through
Self::events; drop to uninstall. Single-threaded by construction:
the installed subscriber is per-thread (via
tracing::subscriber::set_default), and the inner buffer is
reachable only through this guard. !Send is structural — the
Rc and the tracing::dispatcher::DefaultGuard both inherit it.
Implementations§
Source§impl DiagnosticCapture
impl DiagnosticCapture
Sourcepub fn install() -> Self
pub fn install() -> Self
Install a capture with the default capacity
(DIAGNOSTIC_CAPTURE_DEFAULT_CAPACITY).
Captures lean_rs events at every level for the duration of the
returned guard. Events from other targets are dropped (they
still pass through to any outer subscriber the test may have
installed earlier, because set_default is scoped per thread).
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Install a capture with a custom event-buffer capacity.
Sourcepub fn events(&self) -> Vec<CapturedEvent>
pub fn events(&self) -> Vec<CapturedEvent>
Snapshot of the captured events so far, in insertion order. Cheap clone; the capture buffer keeps accumulating after the call.
Sourcepub fn overflowed(&self) -> usize
pub fn overflowed(&self) -> usize
Number of events that were dropped because the bounded buffer
was full. 0 for any test that stays under Self::capacity.