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>
impl<T, I> Scanner<T, I>
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.
Trait Implementations§
impl<T: Copy, I> Copy for Scanner<T, I>
Auto Trait Implementations§
impl<T, I> Freeze for Scanner<T, I>where
T: Freeze,
impl<T, I> RefUnwindSafe for Scanner<T, I>where
T: RefUnwindSafe,
impl<T, I> Send for Scanner<T, I>where
T: Send,
impl<T, I> Sync for Scanner<T, I>where
T: Sync,
impl<T, I> Unpin for Scanner<T, I>where
T: Unpin,
impl<T, I> UnwindSafe for Scanner<T, I>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more