television_previewers/
ansi.rs#![allow(unused_imports)]
pub mod code;
pub mod error;
pub mod parser;
pub use error::Error;
use tui::text::Text;
pub trait IntoText {
#[allow(clippy::wrong_self_convention)]
fn into_text(&self) -> Result<Text<'static>, Error>;
#[cfg(feature = "zero-copy")]
fn to_text(&self) -> Result<Text<'_>, Error>;
}
impl<T> IntoText for T
where
T: AsRef<[u8]>,
{
fn into_text(&self) -> Result<Text<'static>, Error> {
Ok(crate::ansi::parser::text(self.as_ref())?.1)
}
#[cfg(feature = "zero-copy")]
fn to_text(&self) -> Result<Text<'_>, Error> {
Ok(crate::ansi::parser::text_fast(self.as_ref())?.1)
}
}