Struct MapWhile
#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct MapWhile<I, P> { pub(in ::iter::adapters::map_while) iter: I, pub(in ::iter::adapters::map_while) predicate: P }
An iterator that only accepts elements while predicate returns Some(_).
This struct is created by the map_while method on Iterator. See its
documentation for more.
Fields
iter: Ipredicate: P
Implementations
impl<I, P> MapWhile<I, P>
const fn new(iter: I, predicate: P) -> MapWhile<I, P>
Trait Implementations
impl<B, I: Iterator, P> Iterator for MapWhile<I, P>
where
P: FnMut(I::Item) -> Option<B>,
type Item = B;fn next(&mut self) -> Option<B>fn size_hint(&self) -> (usize, Option<usize>)fn try_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> R where Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try<Output = Acc>,fn fold<AAA, FFF>(self, init: AAA, fold: FFF) -> AAA where FFF: FnMut(AAA, Self::Item) -> AAA,
impl<I, P> SourceIter for MapWhile<I, P>
where
I: SourceIter,
type Source = <I as SourceIter>::Source;unsafe fn as_inner(&mut self) -> &mut I::Source
impl<I: Clone, P: Clone> Clone for MapWhile<I, P>
fn clone(&self) -> MapWhile<I, P>
impl<I: Debug, P> Debug for MapWhile<I, P>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<I: InPlaceIterable, P> InPlaceIterable for MapWhile<I, P>
const EXPAND_BY: Option<NonZero<usize>> = I::EXPAND_BY;const MERGE_BY: Option<NonZero<usize>> = I::MERGE_BY;
Auto Trait Implementations
impl<I, P> Freeze for MapWhile<I, P>
where
I: Freeze,
P: Freeze,
impl<I, P> RefUnwindSafe for MapWhile<I, P>
where
I: RefUnwindSafe,
P: RefUnwindSafe,
impl<I, P> Send for MapWhile<I, P>
where
I: Send,
P: Send,
impl<I, P> Sync for MapWhile<I, P>
where
I: Sync,
P: Sync,
impl<I, P> Unpin for MapWhile<I, P>
where
I: Unpin,
P: Unpin,
impl<I, P> UnsafeUnpin for MapWhile<I, P>
where
I: UnsafeUnpin,
P: UnsafeUnpin,
impl<I, P> UnwindSafe for MapWhile<I, P>
where
I: UnwindSafe,
P: UnwindSafe,
Blanket Implementations
impl<I> IntoIterator for MapWhile<I, P>
where
I: Iterator,
type Item = <I as Iterator>::Item;type IntoIter = I;fn into_iter(self) -> I
impl<T> Any for MapWhile<I, P>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for MapWhile<I, P>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for MapWhile<I, P>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for MapWhile<I, P>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for MapWhile<I, P>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for MapWhile<I, P>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for MapWhile<I, P>
impl<T, U> Into<U> for MapWhile<I, P>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for MapWhile<I, P>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for MapWhile<I, P>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>