Skip to main content

LazyMatcher

Trait LazyMatcher 

Source
pub trait LazyMatcher<I: HaystackItem>: Matcher<I> {
    type LazyAllMatches<'a, H: HaystackOf<'a, I>>: Iterator<Item = usize>;
    type LazyAllCaptures<'a, H: HaystackOf<'a, I>>: Iterator<Item = (usize, IndexedCaptures)>;

    // Required methods
    fn lazy_matches<'a, H: HaystackOf<'a, I>>(hay: &mut H) -> bool;
    fn lazy_all_matches<'a, H: HaystackOf<'a, I>>(
        hay: &mut H,
    ) -> Self::LazyAllMatches<'a, H>;
    fn lazy_captures<'a, H: HaystackOf<'a, I>>(
        hay: &mut H,
        caps: &mut IndexedCaptures,
    ) -> bool;
    fn lazy_all_captures<'a, H: HaystackOf<'a, I>>(
        hay: &mut H,
        caps: &mut IndexedCaptures,
    ) -> Self::LazyAllCaptures<'a, H>;
}

Required Associated Types§

Source

type LazyAllMatches<'a, H: HaystackOf<'a, I>>: Iterator<Item = usize>

Source

type LazyAllCaptures<'a, H: HaystackOf<'a, I>>: Iterator<Item = (usize, IndexedCaptures)>

Required Methods§

Source

fn lazy_matches<'a, H: HaystackOf<'a, I>>(hay: &mut H) -> bool

Functions exactly the same as Matcher::matches, except that the haystack’s index is left at the first location where the match is considered successful.

Source

fn lazy_all_matches<'a, H: HaystackOf<'a, I>>( hay: &mut H, ) -> Self::LazyAllMatches<'a, H>

Functions exactly the same as Matcher::all_matches, except that the indices are produced in the opposite order. The first value returned by the iterator is the one first encountered in the haystack, not the one that produces the longest match.

Source

fn lazy_captures<'a, H: HaystackOf<'a, I>>( hay: &mut H, caps: &mut IndexedCaptures, ) -> bool

Functions exactly the same as Matcher::captures, except that the haystack’s index and captures represent the first location where the match is considered successful.

Source

fn lazy_all_captures<'a, H: HaystackOf<'a, I>>( hay: &mut H, caps: &mut IndexedCaptures, ) -> Self::LazyAllCaptures<'a, H>

Functions exactly the same as Matcher::all_captures, except that the indices and captures are produced in the opposite order. The first value returned by the iterator is the one first encountered in the haystack, not the one that produces the longest match.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<I: HaystackItem, A: Matcher<I>, const N: usize> LazyMatcher<I> for QuantifierNOrMore<I, A, N>

Source§

impl<I: HaystackItem, A: Matcher<I>, const N: usize, const M: usize> LazyMatcher<I> for QuantifierNToM<I, A, N, M>

Source§

type LazyAllMatches<'a, H: HaystackOf<'a, I>> = Chain<IntoIter<usize>, LazyAllMatchesNToM<'a, I, H, A, N, M>>

Source§

type LazyAllCaptures<'a, H: HaystackOf<'a, I>> = Chain<IntoIter<(usize, IndexedCaptures)>, LazyAllCapturesNToM<'a, I, H, A, N, M>>