1.6.0[][src]Struct alloc::vec::Drain

pub struct Drain<'a, T: 'a> { /* fields omitted */ }

A draining iterator for Vec<T>.

This struct is created by Vec::drain. See its documentation for more.


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


impl<'a, T> Drain<'a, T>[src]

pub fn as_slice(&self) -> &[T]1.46.0[src]

Returns the remaining items of this iterator as a slice.


let mut vec = vec!['a', 'b', 'c'];
let mut drain = vec.drain(..);
assert_eq!(drain.as_slice(), &['a', 'b', 'c']);
let _ = drain.next().unwrap();
assert_eq!(drain.as_slice(), &['b', 'c']);

Trait Implementations

impl<'a, T> AsRef<[T]> for Drain<'a, T>1.46.0[src]

impl<T: Debug, '_> Debug for Drain<'_, T>1.17.0[src]

impl<T, '_> DoubleEndedIterator for Drain<'_, T>[src]

impl<T, '_> Drop for Drain<'_, T>[src]

impl<T, '_> ExactSizeIterator for Drain<'_, T>[src]

impl<T, '_> FusedIterator for Drain<'_, T>1.26.0[src]

impl<T, '_> Iterator for Drain<'_, T>[src]

type Item = T

The type of the elements being iterated over.

impl<T: Send, '_> Send for Drain<'_, T>[src]

impl<T: Sync, '_> Sync for Drain<'_, T>[src]

impl<T, '_> TrustedLen for Drain<'_, T>[src]

Auto Trait Implementations

impl<'a, T> Unpin for Drain<'a, T>

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<I> IntoIterator for I where
    I: Iterator

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.