Struct Rev

struct Rev<T> { ... }

A double-ended iterator with the direction inverted.

This struct is created by the rev method on Iterator. See its documentation for more.

Implementations

impl<T> Rev<T>

fn into_inner(self: Self) -> T

Consumes the Rev, returning the inner iterator.

Examples

#![feature(rev_into_inner)]

let s = "foobar";
let mut rev = s.chars().rev();
assert_eq!(rev.next(), Some('r'));
assert_eq!(rev.next(), Some('a'));
assert_eq!(rev.next(), Some('b'));
assert_eq!(rev.into_inner().collect::<String>(), "foo");

impl<I> DoubleEndedIterator for Rev<I>

fn next_back(self: &mut Self) -> Option<<I as Iterator>::Item>
fn advance_back_by(self: &mut Self, n: usize) -> Result<(), NonZero<usize>>
fn nth_back(self: &mut Self, n: usize) -> Option<<I as Iterator>::Item>
fn try_rfold<B, F, R>(self: &mut Self, init: B, f: F) -> R
where
    Self: Sized,
    F: FnMut(B, <Self as >::Item) -> R,
    R: Try<Output = B>
fn rfold<Acc, F>(self: Self, init: Acc, f: F) -> Acc
where
    F: FnMut(Acc, <Self as >::Item) -> Acc
fn rfind<P>(self: &mut Self, predicate: P) -> Option<<Self as >::Item>
where
    P: FnMut(&<Self as >::Item) -> bool

impl<I> ExactSizeIterator for Rev<I>

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

impl<I> FusedIterator for Rev<I>

impl<I> IntoIterator for Rev<T>

fn into_iter(self: Self) -> I

impl<I> Iterator for Rev<I>

fn next(self: &mut Self) -> Option<<I as Iterator>::Item>
fn size_hint(self: &Self) -> (usize, Option<usize>)
fn advance_by(self: &mut Self, n: usize) -> Result<(), NonZero<usize>>
fn nth(self: &mut Self, n: usize) -> Option<<I as Iterator>::Item>
fn try_fold<B, F, R>(self: &mut Self, init: B, f: F) -> R
where
    Self: Sized,
    F: FnMut(B, <Self as >::Item) -> R,
    R: Try<Output = B>
fn fold<Acc, F>(self: Self, init: Acc, f: F) -> Acc
where
    F: FnMut(Acc, <Self as >::Item) -> Acc
fn find<P>(self: &mut Self, predicate: P) -> Option<<Self as >::Item>
where
    P: FnMut(&<Self as >::Item) -> bool

impl<I> TrustedLen for Rev<I>

impl<I: Default> Default for Rev<I>

fn default() -> Self

Creates a Rev iterator from the default value of I

# use core::slice;
# use core::iter::Rev;
let iter: Rev<slice::Iter<'_, u8>> = Default::default();
assert_eq!(iter.len(), 0);

impl<T> Any for Rev<T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Rev<T>

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

impl<T> BorrowMut for Rev<T>

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

impl<T> CloneToUninit for Rev<T>

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

impl<T> Freeze for Rev<T>

impl<T> From for Rev<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> RefUnwindSafe for Rev<T>

impl<T> Send for Rev<T>

impl<T> Sync for Rev<T>

impl<T> Unpin for Rev<T>

impl<T> UnsafeUnpin for Rev<T>

impl<T> UnwindSafe for Rev<T>

impl<T, U> Into for Rev<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 Rev<T>

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

impl<T, U> TryInto for Rev<T>

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

impl<T: $crate::clone::Clone> Clone for Rev<T>

fn clone(self: &Self) -> Rev<T>

impl<T: $crate::fmt::Debug> Debug for Rev<T>

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