pub struct AnsiStripStream { /* private fields */ }Expand description
Stateful ANSI stripper for chunked input such as a PTY byte stream.
anstream’s incremental adapter resets its parser to the ground state at
each call, so it cannot recover a sequence split across two chunks. This
wrapper holds back only the trailing, unterminated escape sequence and
re-strips it together with the next chunk. Both the boundary detector and
anstream use anstyle_parse’s state machine, so they cannot disagree on
where a sequence ends. The retained suffix is bounded.
Implementations§
Source§impl AnsiStripStream
impl AnsiStripStream
Sourcepub fn strip_chunk(&mut self, chunk: &str) -> String
pub fn strip_chunk(&mut self, chunk: &str) -> String
Strip the next chunk, returning its visible text.
A trailing escape sequence that is incomplete in chunk is retained
and prepended to the next call instead of leaking raw control bytes.
Trait Implementations§
Auto Trait Implementations§
impl Forget for AnsiStripStream
impl Freeze for AnsiStripStream
impl Move for AnsiStripStream
impl RefUnwindSafe for AnsiStripStream
impl Send for AnsiStripStream
impl Sync for AnsiStripStream
impl Unpin for AnsiStripStream
impl UnsafeUnpin for AnsiStripStream
impl UnwindSafe for AnsiStripStream
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