pub struct AnsiDecoder { /* private fields */ }Expand description
Translate ANSI escape codes in to styled Text.
This decoder is deliberately lenient: it ignores unknown / malformed escape codes. Style state is preserved across lines (matches Python Rich).
Implementations§
Source§impl AnsiDecoder
impl AnsiDecoder
pub fn new() -> Self
Sourcepub fn decode(&mut self, terminal_text: &str) -> Vec<Text>
pub fn decode(&mut self, terminal_text: &str) -> Vec<Text>
Decode ANSI codes in a multi-line string.
This splits on line boundaries and returns one Text per line, with style state
persisting across lines (same behavior as Python Rich’s AnsiDecoder.decode).
Sourcepub fn decode_line(&mut self, line: &str) -> Text
pub fn decode_line(&mut self, line: &str) -> Text
Decode a line containing ANSI escape codes.
Trait Implementations§
Source§impl Clone for AnsiDecoder
impl Clone for AnsiDecoder
Source§fn clone(&self) -> AnsiDecoder
fn clone(&self) -> AnsiDecoder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AnsiDecoder
impl Debug for AnsiDecoder
Auto Trait Implementations§
impl Freeze for AnsiDecoder
impl RefUnwindSafe for AnsiDecoder
impl Send for AnsiDecoder
impl Sync for AnsiDecoder
impl Unpin for AnsiDecoder
impl UnwindSafe for AnsiDecoder
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