Struct IntoIter

struct IntoIter<T, A: Allocator = crate::alloc::Global> { ... }

An iterator that moves out of a vector.

This struct is created by the into_iter method on Vec (provided by the IntoIterator trait).

Example

let v = vec![0, 1, 2];
let iter: std::vec::IntoIter<_> = v.into_iter();

Implementations

impl<T, A: Allocator> IntoIter<T, A>

fn as_slice(self: &Self) -> &[T]

Returns the remaining items of this iterator as a slice.

Examples

let vec = vec!['a', 'b', 'c'];
let mut into_iter = vec.into_iter();
assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);
let _ = into_iter.next().unwrap();
assert_eq!(into_iter.as_slice(), &['b', 'c']);
fn as_mut_slice(self: &mut Self) -> &mut [T]

Returns the remaining items of this iterator as a mutable slice.

Examples

let vec = vec!['a', 'b', 'c'];
let mut into_iter = vec.into_iter();
assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);
into_iter.as_mut_slice()[2] = 'z';
assert_eq!(into_iter.next().unwrap(), 'a');
assert_eq!(into_iter.next().unwrap(), 'b');
assert_eq!(into_iter.next().unwrap(), 'z');
fn allocator(self: &Self) -> &A

Returns a reference to the underlying allocator.

impl<I> IntoIterator for IntoIter<T, A>

fn into_iter(self: Self) -> I

impl<T> Any for IntoIter<T, A>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for IntoIter<T, A>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for IntoIter<T, A>

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

impl<T> CloneToUninit for IntoIter<T, A>

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

impl<T> From for IntoIter<T, A>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for IntoIter<T, A>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, A> Default for IntoIter<T, A>

fn default() -> Self

Creates an empty vec::IntoIter.

# use std::vec;
let iter: vec::IntoIter<u8> = Default::default();
assert_eq!(iter.len(), 0);
assert_eq!(iter.as_slice(), &[]);

impl<T, A> Freeze for IntoIter<T, A>

impl<T, A> RefUnwindSafe for IntoIter<T, A>

impl<T, A> Unpin for IntoIter<T, A>

impl<T, A> UnsafeUnpin for IntoIter<T, A>

impl<T, A: Allocator> AsRef for IntoIter<T, A>

fn as_ref(self: &Self) -> &[T]

impl<T, A: Allocator> DoubleEndedIterator for IntoIter<T, A>

fn next_back(self: &mut Self) -> Option<T>
fn advance_back_by(self: &mut Self, n: usize) -> Result<(), NonZero<usize>>

impl<T, A: Allocator> Drop for IntoIter<T, A>

fn drop(self: &mut Self)

impl<T, A: Allocator> ExactSizeIterator for IntoIter<T, A>

fn is_empty(self: &Self) -> bool

impl<T, A: Allocator> FusedIterator for IntoIter<T, A>

impl<T, A: Allocator> Iterator for IntoIter<T, A>

fn next(self: &mut Self) -> Option<T>
fn size_hint(self: &Self) -> (usize, Option<usize>)
fn advance_by(self: &mut Self, n: usize) -> Result<(), NonZero<usize>>
fn count(self: Self) -> usize
fn last(self: Self) -> Option<T>
fn next_chunk<N: usize>(self: &mut Self) -> Result<[T; N], IntoIter<T, N>>
fn fold<B, F>(self: Self, accum: B, f: F) -> B
where
    F: FnMut(B, <Self as >::Item) -> B
fn try_fold<B, F, R>(self: &mut Self, accum: B, f: F) -> R
where
    Self: Sized,
    F: FnMut(B, <Self as >::Item) -> R,
    R: Try<Output = B>

impl<T, A: Allocator> TrustedLen for IntoIter<T, A>

impl<T, U> Into for IntoIter<T, A>

fn into(self: 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 for IntoIter<T, A>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for IntoIter<T, A>

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

impl<T: Clone, A: Allocator + Clone> Clone for IntoIter<T, A>

fn clone(self: &Self) -> Self

impl<T: Send, A: Allocator + Send> Send for IntoIter<T, A>

impl<T: Sync, A: Allocator + Sync> Sync for IntoIter<T, A>

impl<T: UnwindSafe, A: Allocator + UnwindSafe> UnwindSafe for IntoIter<T, A>

impl<T: fmt::Debug, A: Allocator> Debug for IntoIter<T, A>

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