tui_syntax_highlight/
lib.rs1#![warn(missing_docs, missing_debug_implementations)]
2#![forbid(clippy::unwrap_used)]
3#![cfg_attr(docsrs, feature(doc_cfg))]
4#![doc = include_str!("../README.md")]
5
6mod convert;
7mod highlighter;
8
9use std::fmt::{self, Display};
10use std::io;
11
12pub use convert::*;
13pub use highlighter::*;
14pub use syntect;
15#[cfg(feature = "termprofile")]
16pub use termprofile;
17
18#[derive(Debug)]
20pub enum Error {
21 Read(io::Error),
23 Highlight(syntect::Error),
25}
26
27impl std::error::Error for Error {}
28
29impl Display for Error {
30 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31 match self {
32 Self::Read(e) => write!(f, "error reading from source: {e:?}"),
33 Self::Highlight(e) => write!(f, "error highlighting content: {e:?}"),
34 }
35 }
36}