pub struct StderrTail { /* private fields */ }Expand description
A background drain of one stderr stream. Keeps the most recent lines whose
total size is at most max_bytes; older lines fall off the front.
Implementations§
Source§impl StderrTail
impl StderrTail
Sourcepub fn capture<R: Read + Send + 'static>(
stderr: R,
max_bytes: usize,
map: impl Fn(&str) -> Option<String> + Send + 'static,
on_line: impl Fn(&str) + Send + 'static,
) -> Self
pub fn capture<R: Read + Send + 'static>( stderr: R, max_bytes: usize, map: impl Fn(&str) -> Option<String> + Send + 'static, on_line: impl Fn(&str) + Send + 'static, ) -> Self
Drain stderr on a thread. map sees every line first and returns the
text to keep (redaction), or None to drop it. on_line receives the
kept text as it arrives (forward to logs/telemetry).
Sourcepub fn plain<R: Read + Send + 'static>(stderr: R, max_bytes: usize) -> Self
pub fn plain<R: Read + Send + 'static>(stderr: R, max_bytes: usize) -> Self
Capture with no redaction and no forwarding.
Sourcepub fn finish_within(&mut self, timeout: Duration) -> String
pub fn finish_within(&mut self, timeout: Duration) -> String
Like Self::finish but gives up after timeout (a grandchild that
inherited stderr can keep the stream open after the child is gone) and
returns what was captured so far.
Auto Trait Implementations§
impl !RefUnwindSafe for StderrTail
impl !UnwindSafe for StderrTail
impl Freeze for StderrTail
impl Send for StderrTail
impl Sync for StderrTail
impl Unpin for StderrTail
impl UnsafeUnpin for StderrTail
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