Skip to main content

CharFilter

Trait CharFilter 

Source
pub trait CharFilter: Send + Sync {
    // Required method
    fn filter(&self, text: &str) -> (String, Vec<OffsetCorrection>);
}
Expand description

Transforms raw text before tokenization.

Implementations must be thread-safe (Send + Sync) so that analyzers can be shared across indexing threads.

Required Methods§

Source

fn filter(&self, text: &str) -> (String, Vec<OffsetCorrection>)

Transform the input text.

Returns the transformed text and a list of offset corrections for mapping filtered-text positions back to original-text positions. If the filter doesn’t change text length (e.g., simple char mapping), the corrections list may be empty.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§