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

pub struct Drain<'a, T, A = Global> where
    A: 'a + AllocRef,
    T: 'a, 
{ /* fields omitted */ }

A draining iterator for Vec<T>.

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

Example

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

Implementations

impl<'a, T, A> Drain<'a, T, A> where
    A: AllocRef
[src]

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

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
1.46.0[src]

Returns the remaining items of this iterator as a slice.

Examples

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']);
Run

pub fn alloc_ref(&self) -> &A

Notable traits for &'_ mut I

impl<'_, I> Iterator for &'_ mut I where
    I: Iterator + ?Sized
type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
    F: Unpin + Future + ?Sized
type Output = <F as Future>::Output;impl<R: Read + ?Sized, '_> Read for &'_ mut Rimpl<W: Write + ?Sized, '_> Write for &'_ mut W
[src]

🔬 This is a nightly-only experimental API. (allocator_api #32838)

Returns a reference to the underlying allocator.

Trait Implementations

impl<'a, T, A> AsRef<[T]> for Drain<'a, T, A> where
    A: AllocRef
1.46.0[src]

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

impl<'_, T, A> DoubleEndedIterator for Drain<'_, T, A> where
    A: AllocRef
[src]

impl<'_, T, A> Drop for Drain<'_, T, A> where
    A: AllocRef
[src]

impl<'_, T, A> ExactSizeIterator for Drain<'_, T, A> where
    A: AllocRef
[src]

impl<'_, T, A> FusedIterator for Drain<'_, T, A> where
    A: AllocRef
1.26.0[src]

impl<'_, T, A> Iterator for Drain<'_, T, A> where
    A: AllocRef
[src]

type Item = T

The type of the elements being iterated over.

impl<'_, T, A> Send for Drain<'_, T, A> where
    A: Send + AllocRef,
    T: Send
[src]

impl<'_, T, A> Sync for Drain<'_, T, A> where
    A: Sync + AllocRef,
    T: Sync
[src]

impl<'_, T, A> TrustedLen for Drain<'_, T, A> where
    A: AllocRef
[src]

Auto Trait Implementations

impl<'a, T, A> RefUnwindSafe for Drain<'a, T, A> where
    A: RefUnwindSafe,
    T: RefUnwindSafe

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

impl<'a, T, A> UnwindSafe for Drain<'a, T, A> where
    A: RefUnwindSafe,
    T: RefUnwindSafe

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

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>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.