DoubleEndedSearcher in std::str::pattern - Rust (original) (raw)

Trait DoubleEndedSearcher

Source

pub trait DoubleEndedSearcher<'a>: ReverseSearcher<'a> { }

🔬This is a nightly-only experimental API. (pattern #27721)

Expand description

A marker trait to express that a ReverseSearchercan be used for a DoubleEndedIterator implementation.

For this, the impl of Searcher and ReverseSearcher need to follow these conditions:

§Examples

char::Searcher is a DoubleEndedSearcher because searching for achar only requires looking at one at a time, which behaves the same from both ends.

(&str)::Searcher is not a DoubleEndedSearcher because the pattern "aa" in the haystack "aaa" matches as either"[aa]a" or "a[aa]", depending on which side it is searched.