Struct FlatMap

#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct FlatMap<I, U: IntoIterator, F> { pub(in ::iter::adapters::flatten) inner: FlattenCompat<Map<I, F>, <U as IntoIterator>::IntoIter> }

An iterator that maps each element to an iterator, and yields the elements of the produced iterators.

This struct is created by Iterator::flat_map. See its documentation for more.

Fields

inner: FlattenCompat<Map<I, F>, <U as IntoIterator>::IntoIter>

Implementations

impl<I: Iterator, U: IntoIterator, F: FnMut(I::Item) -> U> FlatMap<I, U, F>

fn new(iter: I, f: F) -> FlatMap<I, U, F>
fn into_parts(self) -> (Option<U::IntoIter>, Option<I>, Option<U::IntoIter>)

Trait Implementations

impl<I, U, F> FusedIterator for FlatMap<I, U, F> where I: FusedIterator, U: IntoIterator, F: FnMut(I::Item) -> U,

impl<I, U, F> SourceIter for FlatMap<I, U, F> where I: SourceIter + TrustedFused, U: IntoIterator,

type Source = <I as SourceIter>::Source;
unsafe fn as_inner(&mut self) -> &mut I::Source

impl<I, U, F> TrustedLen for FlatMap<I, U, F> where I: Iterator, U: IntoIterator, F: FnMut(I::Item) -> U, FlattenCompat<Map<I, F>, <U as IntoIterator>::IntoIter>: TrustedLen,

impl<I: Clone, U, F: Clone> Clone for FlatMap<I, U, F> where U: Clone + IntoIterator<IntoIter: Clone>,

fn clone(&self) -> Self

impl<I: Debug, U, F> Debug for FlatMap<I, U, F> where U: IntoIterator<IntoIter: Debug>,

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<I: DoubleEndedIterator, U, F> DoubleEndedIterator for FlatMap<I, U, F> where F: FnMut(I::Item) -> U, U: IntoIterator<IntoIter: DoubleEndedIterator>,

fn next_back(&mut self) -> Option<U::Item>
fn try_rfold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> R
where
    Self: Sized,
    Fold: FnMut(Acc, Self::Item) -> R,
    R: Try<Output = Acc>,
fn rfold<Acc, Fold>(self, init: Acc, fold: Fold) -> Acc
where
    Fold: FnMut(Acc, Self::Item) -> Acc,
fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

impl<I: Iterator, U: IntoIterator, F> Iterator for FlatMap<I, U, F> where F: FnMut(I::Item) -> U,

type Item = <U as IntoIterator>::Item;
fn next(&mut self) -> Option<U::Item>
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<Acc, Fold>(self, init: Acc, fold: Fold) -> Acc
where
    Fold: FnMut(Acc, Self::Item) -> Acc,
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn count(self) -> usize
fn last(self) -> Option<Self::Item>

Auto Trait Implementations

impl<I, U, F> Freeze for FlatMap<I, U, F> where FlattenCompat<Map<I, F>, <U as IntoIterator>::IntoIter>: Freeze,

impl<I, U, F> RefUnwindSafe for FlatMap<I, U, F> where FlattenCompat<Map<I, F>, <U as IntoIterator>::IntoIter>: RefUnwindSafe,

impl<I, U, F> Send for FlatMap<I, U, F> where FlattenCompat<Map<I, F>, <U as IntoIterator>::IntoIter>: Send,

impl<I, U, F> Sync for FlatMap<I, U, F> where FlattenCompat<Map<I, F>, <U as IntoIterator>::IntoIter>: Sync,

impl<I, U, F> Unpin for FlatMap<I, U, F> where FlattenCompat<Map<I, F>, <U as IntoIterator>::IntoIter>: Unpin,

impl<I, U, F> UnsafeUnpin for FlatMap<I, U, F> where FlattenCompat<Map<I, F>, <U as IntoIterator>::IntoIter>: UnsafeUnpin,

impl<I, U, F> UnwindSafe for FlatMap<I, U, F> where FlattenCompat<Map<I, F>, <U as IntoIterator>::IntoIter>: UnwindSafe,

Blanket Implementations

impl<I> IntoIterator for FlatMap<I, U, F> where I: Iterator,

type Item = <I as Iterator>::Item;
type IntoIter = I;
fn into_iter(self) -> I

impl<T> Any for FlatMap<I, U, F> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for FlatMap<I, U, F> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for FlatMap<I, U, F> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for FlatMap<I, U, F> where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for FlatMap<I, U, F>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for FlatMap<I, U, F> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for FlatMap<I, U, F>

impl<T, U> Into<U> for FlatMap<I, U, F> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for FlatMap<I, U, F> 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 FlatMap<I, U, F> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>