Trait core::str::pattern::DoubleEndedSearcher
[−]
[src]
pub trait DoubleEndedSearcher<'a>: ReverseSearcher<'a> { }
A marker trait to express that a ReverseSearcher
`ReverseSearchercan be used for a
`
can be used for a DoubleEndedIterator
`DoubleEndedIterator` implementation.
For this, the impl of Searcher
`Searcherand
` and ReverseSearcher
`ReverseSearcher` need
to follow these conditions:
- All results of
next()
`next()need to be identical to the results of
` need to be identical to the results ofnext_back()
`next_back()` in reverse order. next()
`next()and
` andnext_back()
`next_back()` need to behave as the two ends of a range of values, that is they can not "walk past each other".
Examples
char::Searcher
`char::Searcheris a
` is a DoubleEndedSearcher
`DoubleEndedSearcherbecause searching for a
` because searching for a
char
`char` only requires looking at one at a time, which behaves the same
from both ends.
(&str)::Searcher
`(&str)::Searcheris not a
` is not a DoubleEndedSearcher
`DoubleEndedSearcherbecause the pattern
` because
the pattern "aa"
`"aa"in the haystack
` in the haystack "aaa"
`"aaa"matches as either
` matches as either
"[aa]a"
`"[aa]a"or
` or "a[aa]"
`"a[aa]"`, depending from which side it is searched.
Implementors
impl<'a> DoubleEndedSearcher<'a> for CharSearcher<'a>
impl<'a, 'b> DoubleEndedSearcher<'a> for CharSliceSearcher<'a, 'b>
impl<'a, F> DoubleEndedSearcher<'a> for CharPredicateSearcher<'a, F> where F: FnMut(char) -> bool