Struct Cloned

#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct Cloned<I> { pub(in ::iter::adapters::cloned) it: I }

An iterator that clones the elements of an underlying iterator.

This struct is created by the cloned method on Iterator. See its documentation for more.

Fields

it: I

Implementations

impl<I> Cloned<I>

const fn new(it: I) -> Cloned<I>

Trait Implementations

impl<'a, I, T> DoubleEndedIterator for Cloned<I> where I: DoubleEndedIterator<Item = &'a T>, T: Clone + 'a,

fn next_back(&mut self) -> Option<T>
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
where
    Self: Sized,
    F: FnMut(B, Self::Item) -> R,
    R: Try<Output = B>,
fn rfold<Acc, F>(self, init: Acc, f: F) -> Acc
where
    F: FnMut(Acc, Self::Item) -> Acc,

impl<'a, I, T> ExactSizeIterator for Cloned<I> where I: ExactSizeIterator<Item = &'a T>, T: Clone + 'a,

fn len(&self) -> usize
fn is_empty(&self) -> bool

impl<'a, I, T> FusedIterator for Cloned<I> where I: FusedIterator<Item = &'a T>, T: Clone + 'a,

impl<'a, I, T> Iterator for Cloned<I> where I: Iterator<Item = &'a T>, T: Clone + 'a,

type Item = T;
fn next(&mut self) -> Option<T>
fn size_hint(&self) -> (usize, Option<usize>)
fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where
    Self: Sized,
    F: FnMut(B, Self::Item) -> R,
    R: Try<Output = B>,
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) -> T
where
    Self: TrustedRandomAccessNoCoerce,

impl<'a, I, T> TrustedLen for Cloned<I> where I: TrustedLen<Item = &'a T>, T: Clone + 'a,

impl<I> SourceIter for Cloned<I> where I: SourceIter,

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

impl<I> TrustedRandomAccess for Cloned<I> where I: TrustedRandomAccess,

impl<I> TrustedRandomAccessNoCoerce for Cloned<I> where I: TrustedRandomAccessNoCoerce,

const MAY_HAVE_SIDE_EFFECT: bool = true;

impl<I: Clone> Clone for Cloned<I>

fn clone(&self) -> Cloned<I>

impl<I: Debug> Debug for Cloned<I>

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

impl<I: Default> Default for Cloned<I>

fn default() -> Self

Creates a Cloned iterator from the default value of I

# use core::slice;
# use core::iter::Cloned;
let iter: Cloned<slice::Iter<'_, u8>> = Default::default();
assert_eq!(iter.len(), 0);

impl<I: InPlaceIterable> InPlaceIterable for Cloned<I>

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

impl<I: OneShot> OneShot for Cloned<I>

Auto Trait Implementations

impl<I> Freeze for Cloned<I> where I: Freeze,

impl<I> RefUnwindSafe for Cloned<I> where I: RefUnwindSafe,

impl<I> Send for Cloned<I> where I: Send,

impl<I> Sync for Cloned<I> where I: Sync,

impl<I> Unpin for Cloned<I> where I: Unpin,

impl<I> UnsafeUnpin for Cloned<I> where I: UnsafeUnpin,

impl<I> UnwindSafe for Cloned<I> where I: UnwindSafe,

Blanket Implementations

impl<I> IntoIterator for Cloned<I> where I: Iterator,

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

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> CloneToUninit for Cloned<I> where T: Clone,

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

impl<T> From<T> for Cloned<I>

fn from(t: T) -> T

Returns the argument unchanged.

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

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

impl<T> SizedTypeProperties for Cloned<I>

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

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