[][src]Struct abi_stable::std_types::vec::Drain

#[repr(C)]pub struct Drain<'a, T> { /* fields omitted */ }

An Iterator returned by RVec::drain , which removes and yields all the elements in a range from the RVec<T>.

Implementations

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

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

Notable traits for &'_ [u8]

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

Returns a slice over the remainder of the Vec<T> that is being drained.

Example

use abi_stable::std_types::RVec;

let mut list=(0..8).collect::<RVec<u8>>();
let mut iter=list.drain(3..7);

assert_eq!( iter.as_slice(), &[3,4,5,6] );

assert_eq!( iter.next(), Some(3) );
assert_eq!( iter.as_slice(), &[4,5,6] );

assert_eq!( iter.next(), Some(4) );
assert_eq!( iter.as_slice(), &[5,6] );

drop(iter);

assert_eq!(list.as_slice(),&[0,1,2,7]);

pub fn as_mut_slice(&mut self) -> &mut [T]

Notable traits for &'_ [u8]

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

Returns a mutable slice over the remainder of the Vec<T> that is being drained.

Example

use abi_stable::std_types::RVec;

let mut list=(0..8).collect::<RVec<u8>>();
let mut iter=list.drain(3..7);

assert_eq!( iter.as_mut_slice(), &mut [3,4,5,6] );

assert_eq!( iter.next(), Some(3) );
assert_eq!( iter.as_mut_slice(), &mut [4,5,6] );

assert_eq!( iter.next(), Some(4) );
assert_eq!( iter.as_mut_slice(), &mut [5,6] );

drop(iter);

assert_eq!(list.as_slice(),&[0,1,2,7]);

Trait Implementations

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

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

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

type Item = T

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for Drain<'a, T> where
    T: RefUnwindSafe
[src]

impl<'a, T> !Send for Drain<'a, T>[src]

impl<'a, T> !Sync for Drain<'a, T>[src]

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

impl<'a, T> !UnwindSafe for Drain<'a, T>[src]

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> GetWithMetadata for T[src]

type ForSelf = WithMetadata_<T, T>

This is always WithMetadata_<Self, Self>

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<I> IteratorExt for I where
    I: Iterator
[src]

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

impl<This> TransmuteElement for This where
    This: ?Sized
[src]

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.

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

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

The error type returned when the conversion fails.

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

type Type = T

The same type as Self. Read more