pub trait EntryProcessor:
Send
+ Sync
+ Clone
+ 'static {
type Data: Send + Sync + Clone + 'static;
// Required methods
fn push_to_injector(&self, line: String, injector: &Injector<Self::Data>);
fn make_entry(
&self,
item: MatchedItem<Self::Data>,
source_output: Option<&Template>,
) -> Entry;
fn has_ansi(&self) -> bool;
fn frecency_key<'a>(item: &Item<'a, Self::Data>) -> Cow<'a, str>;
}Expand description
Implementors of this trait define two things:
- how to push lines into the matcher, including any preprocessing steps (e.g. stripping ANSI codes, applying templates, etc.)
- how to construct the final Entry objects used by the rest of the application from the matched items
The associated type Data defines the type of data stored in the matcher for each line.
Required Associated Types§
Required Methods§
fn push_to_injector(&self, line: String, injector: &Injector<Self::Data>)
fn make_entry( &self, item: MatchedItem<Self::Data>, source_output: Option<&Template>, ) -> Entry
fn has_ansi(&self) -> bool
Sourcefn frecency_key<'a>(item: &Item<'a, Self::Data>) -> Cow<'a, str>
fn frecency_key<'a>(item: &Item<'a, Self::Data>) -> Cow<'a, str>
Extract the frecency key from a matched item for lookup.
This should return the same value that becomes Entry.raw so that
frecency lookups match correctly.
Returns Cow<str> to avoid allocations when possible (e.g., for ASCII text
or when the data is already a String).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".