Expand description
The matcher, as a pure function over &str — no document, no store, no threads.
A host app searching a whole project cannot afford to build a document per row just to ask “does this contain that”: it would parse every scene in the manuscript on every keystroke. It extracts the prose cheaply and matches it here instead.
Exposing it is what keeps there being one definition of a match. An app that
rolled its own would disagree with this crate’s in-document find about whole-word
rules and case folding, and a writer would meet that as “the editor found it but the
search panel didn’t”.
The same goes for folding and for case preservation: an app that lowercased its
own corpus would miss Straße and half-rename a Turkish manuscript. FoldLocale is how
a per-scene language reaches the fold.
FoldedText is the prepared form: a haystack folded once and
searched many times. A search box re-searches the same corpus on every keystroke, and
folding it costs several times what scanning it does — so an app that searches a whole
project keeps one of these per scene rather than rebuilding the fold per character typed.
Structs§
- Fold
Spec - What a fold is allowed to fold away.
- Folded
Text - A haystack folded once, ready to be searched many times.
- Match
- One occurrence, in char offsets into the original haystack — never into the folded copy.
- Match
Options - How to match.
Enums§
- Fold
Locale - The locale tailoring that changes how text folds.
Functions§
- find_
all - Every occurrence of
needleinhaystack, in original char offsets. - preserve_
case - Dress
replacementin the case of the text it is replacing.