Trait SearchText
pub trait SearchText: Send + Sync {
// Required methods
fn segment_count(&self) -> usize;
fn piece_count(&self, segment: usize) -> usize;
fn piece(&self, segment: usize, piece: usize) -> Option<SearchPiece<'_>>;
// Provided methods
fn locates(&self, segment: usize) -> bool { ... }
fn location(&self, segment: usize) -> Option<SearchEntry> { ... }
}Expand description
Long text a search entry is found by, owned by the app: the index reads it while indexing and never copies it. It is a sequence of segments (the unit a hit can point at: a paragraph, a block), each a sequence of pieces. It must not change once handed to an entry; changed prose is a new body.
Required Methods§
fn segment_count(&self) -> usize
fn piece_count(&self, segment: usize) -> usize
fn piece(&self, segment: usize, piece: usize) -> Option<SearchPiece<'_>>
Provided Methods§
fn locates(&self, segment: usize) -> bool
fn locates(&self, segment: usize) -> bool
Whether a match in segment is a hit of its own (Self::location)
rather than the entry’s.
fn location(&self, segment: usize) -> Option<SearchEntry>
fn location(&self, segment: usize) -> Option<SearchEntry>
The hit a match in segment is — a reading location, invoking the
action that opens the text there — when Self::locates says so.