Struct tracing_capture::predicates::Scanner
source · pub struct Scanner<T, I> { /* private fields */ }
Expand description
Helper that allows using Predicate
s rather than closures to find matching elements,
and provides more informative error messages.
Returned by the ScanExt
methods; see its docs for more details.
Implementations§
source§impl<T, I> Scanner<T, I>where
I: Iterator,
I::Item: Debug,
impl<T, I> Scanner<T, I>where
I: Iterator,
I::Item: Debug,
sourcepub fn single<P: Predicate<I::Item> + ?Sized>(self, predicate: &P) -> I::Item
pub fn single<P: Predicate<I::Item> + ?Sized>(self, predicate: &P) -> I::Item
Finds the single item matching the predicate.
Panics
Panics with an informative message if no items, or multiple items match the predicate.
sourcepub fn first<P: Predicate<I::Item> + ?Sized>(self, predicate: &P) -> I::Item
pub fn first<P: Predicate<I::Item> + ?Sized>(self, predicate: &P) -> I::Item
Finds the first item matching the predicate.
Panics
Panics with an informative message if no items match the predicate.