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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)