Module lita

Module lita 

Source
Available on crate features regex-automata and regex-lita only.
Expand description

A meta regex engine optimized for literal pattern and ASCII haystack matching.

Compared to cp::Regex, this engine has much better performance if and only if one of the following conditions is met:

  • Your pattern is often a literal string (i.e. plain text, optionally with pinyin/romaji match).
  • A fair portion of your haystacks is ASCII-only.

A typical use case that meets the above conditions is matching file names and paths.

It has the following limitations though:

  • UTF-8 only. The pattern and haystack must be valid UTF-8, otherwise the engine may panic.
  • No find_iter() and captures_iter() at the moment.
  • No build_many().
  • No custom matching callback support.

The primary type in this module is Regex.

§Design

When the pattern is a literal string, cp::Regex is much slower than IbMatcher. This engine uses enum dispatch to utilize the performance of IbMatcher if the pattern is a literal string, and fall back to cp::Regex for other patterns.

And if the haystack is ASCII-only, this engine will try to use a dense DFA first.

Re-exports§

pub use regex::Config;

Structs§

BuildError
An error that can occurred during the construction of a thompson NFA.
Builder
Use builder syntax to set the inputs and finish with build_from_hir().
Regex
A compiled regular expression for searching Unicode haystacks.