Struct Drain
struct Drain<'a, T: 'a, A: Allocator + 'a = crate::alloc::Global> { ... }
A draining iterator for Vec<T>.
This struct is created by Vec::drain.
See its documentation for more.
Example
let mut v = vec!;
let iter: Drain = v.drain;
Implementations
impl<'a, T, A: Allocator> Drain<'a, T, A>
fn as_slice(self: &Self) -> &[T]Returns the remaining items of this iterator as a slice.
Examples
let mut vec = vec!; let mut drain = vec.drain; assert_eq!; let _ = drain.next.unwrap; assert_eq!;fn allocator(self: &Self) -> &AReturns a reference to the underlying allocator.
fn keep_rest(self: Self)Keep unyielded elements in the source
Vec.Examples
let mut vec = vec!; let mut drain = vec.drain; assert_eq!; // This call keeps 'b' and 'c' in the vec. drain.keep_rest; // If we wouldn't call `keep_rest()`, // `vec` would be empty. assert_eq!;
impl<'a, T, A> Freeze for Drain<'a, T, A>
impl<'a, T, A> RefUnwindSafe for Drain<'a, T, A>
impl<'a, T, A> Unpin for Drain<'a, T, A>
impl<'a, T, A> UnsafeUnpin for Drain<'a, T, A>
impl<'a, T, A> UnwindSafe for Drain<'a, T, A>
impl<'a, T, A: Allocator> AsRef for Drain<'a, T, A>
fn as_ref(self: &Self) -> &[T]
impl<I> IntoIterator for Drain<'a, T, A>
fn into_iter(self: Self) -> I
impl<T> Any for Drain<'a, T, A>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Drain<'a, T, A>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Drain<'a, T, A>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for Drain<'a, T, A>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, A: Allocator> DoubleEndedIterator for Drain<'_, T, A>
fn next_back(self: &mut Self) -> Option<T>
impl<T, A: Allocator> Drop for Drain<'_, T, A>
fn drop(self: &mut Self)
impl<T, A: Allocator> ExactSizeIterator for Drain<'_, T, A>
fn is_empty(self: &Self) -> bool
impl<T, A: Allocator> FusedIterator for Drain<'_, T, A>
impl<T, A: Allocator> Iterator for Drain<'_, T, A>
fn next(self: &mut Self) -> Option<T>fn size_hint(self: &Self) -> (usize, Option<usize>)
impl<T, A: Allocator> TrustedLen for Drain<'_, T, A>
impl<T, U> Into for Drain<'a, T, A>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Drain<'a, T, A>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Drain<'a, T, A>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T: Send, A: Send + Allocator> Send for Drain<'_, T, A>
impl<T: Sync, A: Sync + Allocator> Sync for Drain<'_, T, A>
impl<T: fmt::Debug, A: Allocator> Debug for Drain<'_, T, A>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result