Struct FlattenCompat

pub(in ::iter::adapters::flatten) struct FlattenCompat<I, U> { pub(in ::iter::adapters::flatten) iter: Fuse<I>, pub(in ::iter::adapters::flatten) frontiter: Option<U>, pub(in ::iter::adapters::flatten) backiter: Option<U> }

Real logic of both Flatten and FlatMap which simply delegate to this type.

Fields

iter: Fuse<I>
frontiter: Option<U>
backiter: Option<U>

Implementations

impl<I, U> FlattenCompat<I, U> where I: DoubleEndedIterator<Item: IntoIterator<IntoIter = U>>,

fn iter_rfold<Acc, Fold>(self, acc: Acc, fold: Fold) -> Acc
where
    Fold: FnMut(Acc, U) -> Acc,

Folds the inner iterators into an accumulator by applying an operation, starting form the back.

Folds over the inner iterators, not over their elements. Is used by the rfold method.

fn iter_try_rfold<Acc, Fold, R>(&mut self, acc: Acc, fold: Fold) -> R
where
    Fold: FnMut(Acc, &mut U) -> R,
    R: Try<Output = Acc>,

Folds over the inner iterators in reverse order as long as the given function returns successfully, always storing the most recent inner iterator in self.backiter.

Folds over the inner iterators, not over their elements. Is used by the try_rfold and advance_back_by methods.

impl<I, U> FlattenCompat<I, U> where I: Iterator<Item: IntoIterator<IntoIter = U>>,

fn iter_fold<Acc, Fold>(self, acc: Acc, fold: Fold) -> Acc
where
    Fold: FnMut(Acc, U) -> Acc,

Folds the inner iterators into an accumulator by applying an operation.

Folds over the inner iterators, not over their elements. Is used by the fold, count, and last methods.

fn iter_try_fold<Acc, Fold, R>(&mut self, acc: Acc, fold: Fold) -> R
where
    Fold: FnMut(Acc, &mut U) -> R,
    R: Try<Output = Acc>,

Folds over the inner iterators as long as the given function returns successfully, always storing the most recent inner iterator in self.frontiter.

Folds over the inner iterators, not over their elements. Is used by the try_fold and advance_by methods.

impl<I, U> FlattenCompat<I, U> where I: ~const Iterator,

const fn new(iter: I) -> FlattenCompat<I, U>

Adapts an iterator by flattening it, for use in flatten() and flat_map().

Trait Implementations

impl<'a, const N: usize, I, T> TrustedLen for FlattenCompat<I, <&'a [T; N] as IntoIterator>::IntoIter> where I: TrustedLen<Item = &'a [T; N]>,

impl<'a, const N: usize, I, T> TrustedLen for FlattenCompat<I, <&'a mut [T; N] as IntoIterator>::IntoIter> where I: TrustedLen<Item = &'a mut [T; N]>,

impl<I, U> DoubleEndedIterator for FlattenCompat<I, U> where I: DoubleEndedIterator<Item: IntoIterator<IntoIter = U, Item = U::Item>>, U: DoubleEndedIterator + OneShot,

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, U> DoubleEndedIterator for FlattenCompat<I, U> where I: DoubleEndedIterator<Item: IntoIterator<IntoIter = U, Item = U::Item>>, U: 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, U> Iterator for FlattenCompat<I, U> where I: Iterator<Item: IntoIterator<IntoIter = U, Item = U::Item>>, U: Iterator + OneShot,

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>

impl<I, U> Iterator for FlattenCompat<I, U> where I: Iterator<Item: IntoIterator<IntoIter = U, Item = U::Item>>, U: Iterator,

type Item = <U as Iterator>::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>

impl<I: Clone, U: Clone> Clone for FlattenCompat<I, U>

fn clone(&self) -> FlattenCompat<I, U>

impl<I: Debug, U: Debug> Debug for FlattenCompat<I, U>

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

impl<const N: usize, I, T> TrustedLen for FlattenCompat<I, <[T; N] as IntoIterator>::IntoIter> where I: TrustedLen<Item = [T; N]>,

Auto Trait Implementations

impl<I, U> Freeze for FlattenCompat<I, U> where Fuse<I>: Freeze, Option<U>: Freeze + Freeze,

impl<I, U> RefUnwindSafe for FlattenCompat<I, U> where Fuse<I>: RefUnwindSafe, Option<U>: RefUnwindSafe + RefUnwindSafe,

impl<I, U> Send for FlattenCompat<I, U> where Fuse<I>: Send, Option<U>: Send + Send,

impl<I, U> Sync for FlattenCompat<I, U> where Fuse<I>: Sync, Option<U>: Sync + Sync,

impl<I, U> Unpin for FlattenCompat<I, U> where Fuse<I>: Unpin, Option<U>: Unpin + Unpin,

impl<I, U> UnsafeUnpin for FlattenCompat<I, U> where Fuse<I>: UnsafeUnpin, Option<U>: UnsafeUnpin + UnsafeUnpin,

impl<I, U> UnwindSafe for FlattenCompat<I, U> where Fuse<I>: UnwindSafe, Option<U>: UnwindSafe + UnwindSafe,

Blanket Implementations

impl<I> IntoIterator for FlattenCompat<I, U> where I: Iterator,

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

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for FlattenCompat<I, U>

fn from(t: T) -> T

Returns the argument unchanged.

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

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

impl<T> SizedTypeProperties for FlattenCompat<I, U>

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

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