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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more