Struct IterMut

struct IterMut<'a, T: 'a> { ... }

A mutable iterator over the elements of a VecDeque.

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

Implementations

impl<'a, T> IterMut<'a, T>

fn into_slices(self: Self) -> (&'a mut [T], &'a mut [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.

To avoid creating &mut references that alias, this is forced to consume the iterator.

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_mut();
iter.next();
iter.next_back();

let slices = iter.into_slices();
slices.0[0] = 42;
slices.1[0] = 24;
assert_eq!(deque.as_slices(), (&[8, 42, 10][..], &[24, 1, 2][..]));
fn as_slices(self: &Self) -> (&[T], &[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.

To avoid creating &mut [T] references that alias, the returned slices borrow their lifetimes from the iterator the method is applied on.

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_mut();
iter.next();
iter.next_back();

assert_eq!(iter.as_slices(), (&[9, 10][..], &[0, 1][..]));
fn as_mut_slices(self: &mut Self) -> (&mut [T], &mut [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.

To avoid creating &mut [T] references that alias, the returned slices borrow their lifetimes from the iterator the method is applied on.

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_mut();
iter.next();
iter.next_back();

iter.as_mut_slices().0[0] = 42;
iter.as_mut_slices().1[0] = 24;
assert_eq!(deque.as_slices(), (&[8, 42, 10][..], &[24, 1, 2][..]));

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

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

impl<'a, T> Freeze for IterMut<'a, T>

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

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

impl<'a, T> RefUnwindSafe for IterMut<'a, T>

impl<'a, T> Send for IterMut<'a, T>

impl<'a, T> Sync for IterMut<'a, T>

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

impl<'a, T> UnsafeUnpin for IterMut<'a, T>

impl<'a, T> UnwindSafe for IterMut<'a, T>

impl<I> IntoIterator for IterMut<'a, T>

fn into_iter(self: Self) -> I

impl<T> Any for IterMut<'a, T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for IterMut<'a, T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for IterMut<'a, T>

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

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

fn default() -> Self

Creates an empty vec_deque::IterMut.

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

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

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

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

fn from(t: T) -> T

Returns the argument unchanged.

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

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

impl<T, U> Into for IterMut<'a, T>

fn into(self: 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 for IterMut<'a, T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for IterMut<'a, T>

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

impl<T: fmt::Debug> Debug for IterMut<'_, T>

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