Struct Copied

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

An iterator that copies the elements of an underlying iterator.

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

Fields

it: I

Implementations

impl<I> Copied<I>

const fn new(it: I) -> Copied<I>
fn into_inner(self) -> I

Trait Implementations

impl<'a, I, T> DoubleEndedIterator for Copied<I> where I: DoubleEndedIterator<Item = &'a T>, T: Copy + '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,
fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

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

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

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

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

type Item = T;
fn next(&mut self) -> Option<T>
fn next_chunk<const N: usize>(&mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where
    Self: Sized,
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,
fn nth(&mut self, n: usize) -> Option<T>
fn last(self) -> Option<T>
fn count(self) -> usize
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> T
where
    Self: TrustedRandomAccessNoCoerce,

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

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

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

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

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

const MAY_HAVE_SIDE_EFFECT: bool = I::MAY_HAVE_SIDE_EFFECT;

impl<I: Clone> Clone for Copied<I>

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

impl<I: Debug> Debug for Copied<I>

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

impl<I: Default> Default for Copied<I>

fn default() -> Self

Creates a Copied iterator from the default value of I

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

impl<I: InPlaceIterable> InPlaceIterable for Copied<I>

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

impl<I: OneShot> OneShot for Copied<I>

Auto Trait Implementations

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

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

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

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

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

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

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

Blanket Implementations

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

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

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for Copied<I>

fn from(t: T) -> T

Returns the argument unchanged.

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

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

impl<T> SizedTypeProperties for Copied<I>

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

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