television_previewers/
ansi.rs1#![allow(unused_imports)]
2pub mod code;
8pub mod error;
9pub mod parser;
10pub use error::Error;
11use tui::text::Text;
12
13pub trait IntoText {
15 #[allow(clippy::wrong_self_convention)]
17 fn into_text(&self) -> Result<Text<'static>, Error>;
18 #[cfg(feature = "zero-copy")]
20 fn to_text(&self) -> Result<Text<'_>, Error>;
21}
22impl<T> IntoText for T
23where
24 T: AsRef<[u8]>,
25{
26 fn into_text(&self) -> Result<Text<'static>, Error> {
27 Ok(crate::ansi::parser::text(self.as_ref())?.1)
28 }
29
30 #[cfg(feature = "zero-copy")]
31 fn to_text(&self) -> Result<Text<'_>, Error> {
32 Ok(crate::ansi::parser::text_fast(self.as_ref())?.1)
33 }
34}