Struct regex::literal::LiteralSearcher [−][src]
pub struct LiteralSearcher {
complete: bool,
lcp: FreqyPacked,
lcs: FreqyPacked,
matcher: Matcher,
}A prefix extracted from a compiled regular expression.
A regex prefix is a set of literal strings that must be matched at the beginning of a regex in order for the entire regex to match. Similarly for a regex suffix.
Fields
complete: bool
lcp: FreqyPacked
lcs: FreqyPacked
matcher: Matcher
Methods
impl LiteralSearcher[src]
impl LiteralSearcherpub fn empty() -> Self[src]
pub fn empty() -> SelfReturns a matcher that never matches and never advances the input.
pub fn prefixes(lits: Literals) -> Self[src]
pub fn prefixes(lits: Literals) -> SelfReturns a matcher for literal prefixes from the given set.
pub fn suffixes(lits: Literals) -> Self[src]
pub fn suffixes(lits: Literals) -> SelfReturns a matcher for literal suffixes from the given set.
fn new(lits: Literals, matcher: Matcher) -> Self[src]
fn new(lits: Literals, matcher: Matcher) -> Selfpub fn complete(&self) -> bool[src]
pub fn complete(&self) -> boolReturns true if all matches comprise the entire regular expression.
This does not necessarily mean that a literal match implies a match
of the regular expression. For example, the regular expresison ^a
is comprised of a single complete literal a, but the regular
expression demands that it only match at the beginning of a string.
pub fn find(&self, haystack: &[u8]) -> Option<(usize, usize)>[src]
pub fn find(&self, haystack: &[u8]) -> Option<(usize, usize)>Find the position of a literal in haystack if it exists.
pub fn find_start(&self, haystack: &[u8]) -> Option<(usize, usize)>[src]
pub fn find_start(&self, haystack: &[u8]) -> Option<(usize, usize)>Like find, except matches must start at index 0.
pub fn find_end(&self, haystack: &[u8]) -> Option<(usize, usize)>[src]
pub fn find_end(&self, haystack: &[u8]) -> Option<(usize, usize)>Like find, except matches must end at index haystack.len().
ⓘImportant traits for LiteralIter<'a>pub fn iter(&self) -> LiteralIter[src]
pub fn iter(&self) -> LiteralIterReturns an iterator over all literals to be matched.
pub fn lcp(&self) -> &FreqyPacked[src]
pub fn lcp(&self) -> &FreqyPackedReturns a matcher for the longest common prefix of this matcher.
pub fn lcs(&self) -> &FreqyPacked[src]
pub fn lcs(&self) -> &FreqyPackedReturns a matcher for the longest common suffix of this matcher.
pub fn is_empty(&self) -> bool[src]
pub fn is_empty(&self) -> boolReturns true iff this prefix is empty.
pub fn len(&self) -> usize[src]
pub fn len(&self) -> usizeReturns the number of prefixes in this machine.
pub fn approximate_size(&self) -> usize[src]
pub fn approximate_size(&self) -> usizeReturn the approximate heap usage of literals in bytes.
Trait Implementations
impl Clone for LiteralSearcher[src]
impl Clone for LiteralSearcherfn clone(&self) -> LiteralSearcher[src]
fn clone(&self) -> LiteralSearcherReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Debug for LiteralSearcher[src]
impl Debug for LiteralSearcherAuto Trait Implementations
impl Send for LiteralSearcher
impl Send for LiteralSearcherimpl Sync for LiteralSearcher
impl Sync for LiteralSearcher