Struct Iter

pub struct Iter<'a, T: 'a> { pub(in ::collections::vec_deque::iter) i1: Iter<'a, T>, pub(in ::collections::vec_deque::iter) i2: Iter<'a, T> }

An iterator over the elements of a VecDeque.

This struct is created by the iter method on super::VecDeque. See its documentation for more.

Fields

i1: Iter<'a, T>
i2: Iter<'a, T>

Implementations

impl<'a, T> Iter<'a, T>

fn new(i1: Iter<'a, T>, i2: Iter<'a, T>) -> Self
fn as_slices(&self) -> (&'a [T], &'a [T])

Views the underlying data as a pair of subslices of the original data.

The slices contain, in order, the contents of the deque not yet yielded by the iterator.

This has the same lifetime as the original VecDeque, and so the iterator can continue to be used while this exists.

Examples

#![feature(vec_deque_iter_as_slices)]

use std::collections::VecDeque;

let mut deque = VecDeque::new();
deque.push_back(0);
deque.push_back(1);
deque.push_back(2);
deque.push_front(10);
deque.push_front(9);
deque.push_front(8);

let mut iter = deque.iter();
iter.next();
iter.next_back();

assert_eq!(iter.as_slices(), (&[9, 10][..], &[0, 1][..]));

Trait Implementations

impl<'a, T> DoubleEndedIterator for Iter<'a, T>

fn next_back(&mut self) -> Option<&'a T>
fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn rfold<Acc, F>(self, accum: Acc, f: F) -> Acc
where
    F: FnMut(Acc, Self::Item) -> Acc,
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
where
    F: FnMut(B, Self::Item) -> R,
    R: Try<Output = B>,

impl<'a, T> Iterator for Iter<'a, T>

type Item = &'a T;
fn next(&mut self) -> Option<&'a T>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn size_hint(&self) -> (usize, Option<usize>)
fn fold<Acc, F>(self, accum: Acc, f: F) -> Acc
where
    F: FnMut(Acc, Self::Item) -> Acc,
fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where
    F: FnMut(B, Self::Item) -> R,
    R: Try<Output = B>,
fn last(self) -> Option<&'a T>
unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> Self::Item

impl<T> Clone for Iter<'_, T>

fn clone(&self) -> Self

impl<T> Default for Iter<'_, T>

fn default() -> Self

Creates an empty vec_deque::Iter.

# use std::collections::vec_deque;
let iter: vec_deque::Iter<'_, u8> = Default::default();
assert_eq!(iter.len(), 0);

impl<T> ExactSizeIterator for Iter<'_, T>

fn len(&self) -> usize
fn is_empty(&self) -> bool

impl<T> FusedIterator for Iter<'_, T>

impl<T> TrustedLen for Iter<'_, T>

impl<T> TrustedRandomAccess for Iter<'_, T>

impl<T> TrustedRandomAccessNoCoerce for Iter<'_, T>

const MAY_HAVE_SIDE_EFFECT: bool = false;

impl<T: Debug> Debug for Iter<'_, T>

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

Auto Trait Implementations

impl<'a, T> Freeze for Iter<'a, T> where Iter<'a, T>: Freeze + Freeze,

impl<'a, T> RefUnwindSafe for Iter<'a, T> where Iter<'a, T>: RefUnwindSafe + RefUnwindSafe,

impl<'a, T> Send for Iter<'a, T> where Iter<'a, T>: Send + Send,

impl<'a, T> Sync for Iter<'a, T> where Iter<'a, T>: Sync + Sync,

impl<'a, T> Unpin for Iter<'a, T> where Iter<'a, T>: Unpin + Unpin,

impl<'a, T> UnsafeUnpin for Iter<'a, T> where Iter<'a, T>: UnsafeUnpin + UnsafeUnpin,

impl<'a, T> UnwindSafe for Iter<'a, T> where Iter<'a, T>: UnwindSafe + UnwindSafe,

Blanket Implementations

impl<I> IntoIterator for Iter<'a, T> where I: Iterator,

type Item = <I as Iterator>::Item;
type IntoIter = I;
fn into_iter(self) -> I

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Iter<'a, T> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Iter<'a, T> where T: ?Sized,

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

impl<T> CloneToUninit for Iter<'a, T> where T: Clone,

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

impl<T> From<T> for Iter<'a, T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for Iter<'a, T> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for Iter<'a, T>

impl<T> ToOwned for Iter<'a, T> where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for Iter<'a, T> where U: From<T>,

fn into(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<U> for Iter<'a, T> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Iter<'a, T> where U: TryFrom<T>,

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