Struct Zip

#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct Zip<A, B> { pub(in ::iter::adapters::zip) a: A, pub(in ::iter::adapters::zip) b: B, pub(in ::iter::adapters::zip) index: usize, pub(in ::iter::adapters::zip) len: usize }

An iterator that iterates two other iterators simultaneously.

This struct is created by zip or Iterator::zip. See their documentation for more.

Fields

a: A
b: B
index: usize
len: usize

Implementations

impl<A: Iterator, B: Iterator> Zip<A, B>

fn new(a: A, b: B) -> Zip<A, B>
fn super_nth(&mut self, n: usize) -> Option<(A::Item, B::Item)>

Trait Implementations

impl<A, B> DoubleEndedIterator for Zip<A, B> where A: DoubleEndedIterator + ExactSizeIterator, B: DoubleEndedIterator + ExactSizeIterator,

fn next_back(&mut self) -> Option<(A::Item, B::Item)>

impl<A, B> ExactSizeIterator for Zip<A, B> where A: ExactSizeIterator, B: ExactSizeIterator,

impl<A, B> FusedIterator for Zip<A, B> where A: FusedIterator, B: FusedIterator,

impl<A, B> Iterator for Zip<A, B> where A: Iterator, B: Iterator,

type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
fn next(&mut self) -> Option<Self::Item>
fn size_hint(&self) -> (usize, Option<usize>)
fn nth(&mut self, n: usize) -> Option<Self::Item>
fn fold<Acc, F>(self, init: Acc, f: F) -> Acc
where
    F: FnMut(Acc, Self::Item) -> Acc,
unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item
where
    Self: TrustedRandomAccessNoCoerce,

impl<A, B> SourceIter for Zip<A, B> where A: SourceIter,

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

impl<A, B> TrustedFused for Zip<A, B> where A: TrustedFused, B: TrustedFused,

impl<A, B> TrustedLen for Zip<A, B> where A: TrustedLen, B: TrustedLen,

impl<A, B> TrustedRandomAccess for Zip<A, B> where A: TrustedRandomAccess, B: TrustedRandomAccess,

impl<A, B> TrustedRandomAccessNoCoerce for Zip<A, B> where A: TrustedRandomAccessNoCoerce, B: TrustedRandomAccessNoCoerce,

const MAY_HAVE_SIDE_EFFECT: bool = _;

impl<A, B> ZipImpl<A, B> for Zip<A, B> where A: Iterator, B: Iterator,

type Item = (<A as Iterator>::Item, <B as Iterator>::Item);
fn new(a: A, b: B) -> Self
fn next(&mut self) -> Option<(A::Item, B::Item)>
fn nth(&mut self, n: usize) -> Option<Self::Item>
fn next_back(&mut self) -> Option<(A::Item, B::Item)>
where
    A: DoubleEndedIterator + ExactSizeIterator,
    B: DoubleEndedIterator + ExactSizeIterator,
fn size_hint(&self) -> (usize, Option<usize>)
unsafe fn get_unchecked(&mut self, _idx: usize) -> <Self as Iterator>::Item
where
    Self: TrustedRandomAccessNoCoerce,
fn fold<Acc, F>(self, init: Acc, f: F) -> Acc
where
    F: FnMut(Acc, Self::Item) -> Acc,

impl<A, B> ZipImpl<A, B> for Zip<A, B> where A: TrustedRandomAccess + Iterator, B: TrustedRandomAccess + Iterator,

fn new(a: A, b: B) -> Self
fn next(&mut self) -> Option<(A::Item, B::Item)>
fn size_hint(&self) -> (usize, Option<usize>)
fn nth(&mut self, n: usize) -> Option<Self::Item>
fn next_back(&mut self) -> Option<(A::Item, B::Item)>
where
    A: DoubleEndedIterator + ExactSizeIterator,
    B: DoubleEndedIterator + ExactSizeIterator,

impl<A, B> ZipImpl<A, B> for Zip<A, B> where A: TrustedRandomAccessNoCoerce + Iterator, B: TrustedRandomAccessNoCoerce + Iterator,

fn new(a: A, b: B) -> Self
fn next(&mut self) -> Option<(A::Item, B::Item)>
fn nth(&mut self, n: usize) -> Option<Self::Item>
fn next_back(&mut self) -> Option<(A::Item, B::Item)>
where
    A: DoubleEndedIterator + ExactSizeIterator,
    B: DoubleEndedIterator + ExactSizeIterator,
fn size_hint(&self) -> (usize, Option<usize>)
unsafe fn get_unchecked(&mut self, idx: usize) -> <Self as Iterator>::Item
fn fold<Acc, F>(self, init: Acc, f: F) -> Acc
where
    F: FnMut(Acc, Self::Item) -> Acc,

impl<A: Clone, B: Clone> Clone for Zip<A, B>

fn clone(&self) -> Zip<A, B>

impl<A: Debug + TrustedRandomAccessNoCoerce, B: Debug + TrustedRandomAccessNoCoerce> ZipFmt<A, B> for Zip<A, B>

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

impl<A: Debug, B: Debug> Debug for Zip<A, B>

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

impl<A: Debug, B: Debug> ZipFmt<A, B> for Zip<A, B>

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

impl<A: InPlaceIterable, B> InPlaceIterable for Zip<A, B>

const EXPAND_BY: Option<NonZero<usize>> = A::EXPAND_BY;
const MERGE_BY: Option<NonZero<usize>> = A::MERGE_BY;

impl<A: Iterator, B: Iterator> SpecFold for Zip<A, B>

fn spec_fold<Acc, F>(self, init: Acc, f: F) -> Acc
where
    F: FnMut(Acc, Self::Item) -> Acc,

impl<A: TrustedLen, B: TrustedLen> SpecFold for Zip<A, B>

fn spec_fold<Acc, F>(self, init: Acc, f: F) -> Acc
where
    F: FnMut(Acc, Self::Item) -> Acc,

Auto Trait Implementations

impl<A, B> Freeze for Zip<A, B> where A: Freeze, B: Freeze,

impl<A, B> RefUnwindSafe for Zip<A, B> where A: RefUnwindSafe, B: RefUnwindSafe,

impl<A, B> Send for Zip<A, B> where A: Send, B: Send,

impl<A, B> Sync for Zip<A, B> where A: Sync, B: Sync,

impl<A, B> Unpin for Zip<A, B> where A: Unpin, B: Unpin,

impl<A, B> UnsafeUnpin for Zip<A, B> where A: UnsafeUnpin, B: UnsafeUnpin,

impl<A, B> UnwindSafe for Zip<A, B> where A: UnwindSafe, B: UnwindSafe,

Blanket Implementations

impl<I> IntoIterator for Zip<A, B> where I: Iterator,

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

impl<T> Any for Zip<A, B> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Zip<A, B> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Zip<A, B> where T: ?Sized,

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

impl<T> CloneToUninit for Zip<A, B> where T: Clone,

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

impl<T> From<T> for Zip<A, B>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for Zip<A, B> where T: ?Sized,

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

impl<T> SizedTypeProperties for Zip<A, B>

impl<T, U> Into<U> for Zip<A, B> 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 Zip<A, B> 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 Zip<A, B> where U: TryFrom<T>,

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