reedline/highlighter/mod.rs
1mod example;
2mod simple_match;
3
4use crate::StyledText;
5
6pub use example::ExampleHighlighter;
7pub use simple_match::SimpleMatchHighlighter;
8/// The syntax highlighting trait. Implementers of this trait will take in the current string and then
9/// return a `StyledText` object, which represents the contents of the original line as styled strings
10pub trait Highlighter: Send {
11 /// The action that will handle the current buffer as a line and return the corresponding `StyledText` for the buffer
12 ///
13 /// Cursor position as byte offsets in the string
14 fn highlight(&self, line: &str, cursor: usize) -> StyledText;
15}