pub struct OutputBuffer { /* private fields */ }Expand description
Bounded combined stdout/stderr accumulator.
The byte and line ceilings are independent so a single oversized line cannot slip past a line-count-only limit. When either trips, the head and the tail are both retained with a marker in between; head-only truncation would hide a script’s final result, which is usually the part worth reading.
Implementations§
Source§impl OutputBuffer
impl OutputBuffer
Sourcepub fn push_fragment(&mut self, fragment: &str)
pub fn push_fragment(&mut self, fragment: &str)
Appends text without terminating the current line.
This is what echo -n and printf produce; the fragment joins whatever the next write
appends, exactly as it would on a real terminal.
Sourcepub fn push_block(&mut self, block: &str)
pub fn push_block(&mut self, block: &str)
Appends a possibly multi-line block and terminates the line.
Sourcepub fn finish(&mut self)
pub fn finish(&mut self)
Flushes any unterminated trailing fragment. Call once before rendering.
Sourcepub fn is_truncated(&self) -> bool
pub fn is_truncated(&self) -> bool
Reports whether any line was dropped or clamped.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OutputBuffer
impl RefUnwindSafe for OutputBuffer
impl Send for OutputBuffer
impl Sync for OutputBuffer
impl Unpin for OutputBuffer
impl UnsafeUnpin for OutputBuffer
impl UnwindSafe for OutputBuffer
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