Struct Rev
#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct Rev<T> { pub(in ::iter::adapters::rev) iter: T }
A double-ended iterator with the direction inverted.
This struct is created by the rev method on Iterator. See its
documentation for more.
Fields
iter: T
Implementations
impl<T> Rev<T>
const fn new(iter: T) -> Rev<T>fn into_inner(self) -> TConsumes the
Rev, returning the inner iterator.Examples
let s = "foobar"; let mut rev = s.chars.rev; assert_eq!; assert_eq!; assert_eq!; assert_eq!;
Trait Implementations
impl<I> DoubleEndedIterator for Rev<I>
where
I: DoubleEndedIterator,
fn next_back(&mut self) -> Option<<I as Iterator>::Item>fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>fn nth_back(&mut self, n: usize) -> Option<<I as Iterator>::Item>fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R where Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try<Output = B>,fn rfold<Acc, F>(self, init: Acc, f: F) -> Acc where F: FnMut(Acc, Self::Item) -> Acc,fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item> where P: FnMut(&Self::Item) -> bool,
impl<I> ExactSizeIterator for Rev<I>
where
I: ExactSizeIterator + DoubleEndedIterator,
fn len(&self) -> usizefn is_empty(&self) -> bool
impl<I> FusedIterator for Rev<I>
where
I: FusedIterator + DoubleEndedIterator,
impl<I> Iterator for Rev<I>
where
I: DoubleEndedIterator,
type Item = <I as Iterator>::Item;fn next(&mut self) -> Option<<I as Iterator>::Item>fn size_hint(&self) -> (usize, Option<usize>)fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>fn nth(&mut self, n: usize) -> Option<<I as Iterator>::Item>fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R where Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try<Output = B>,fn fold<Acc, F>(self, init: Acc, f: F) -> Acc where F: FnMut(Acc, Self::Item) -> Acc,fn find<P>(&mut self, predicate: P) -> Option<Self::Item> where P: FnMut(&Self::Item) -> bool,
impl<I> TrustedLen for Rev<I>
where
I: TrustedLen + DoubleEndedIterator,
impl<I: Default> Default for Rev<I>
fn default() -> SelfCreates a
Reviterator from the default value ofI# use slice; # use Rev; let iter: = Defaultdefault; assert_eq!;
impl<T: Clone> Clone for Rev<T>
fn clone(&self) -> Rev<T>
impl<T: Debug> Debug for Rev<T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<T> Freeze for Rev<T>
where
T: Freeze,
impl<T> RefUnwindSafe for Rev<T>
where
T: RefUnwindSafe,
impl<T> Send for Rev<T>
where
T: Send,
impl<T> Sync for Rev<T>
where
T: Sync,
impl<T> Unpin for Rev<T>
where
T: Unpin,
impl<T> UnsafeUnpin for Rev<T>
where
T: UnsafeUnpin,
impl<T> UnwindSafe for Rev<T>
where
T: UnwindSafe,
Blanket Implementations
impl<I> IntoIterator for Rev<T>
where
I: Iterator,
type Item = <I as Iterator>::Item;type IntoIter = I;fn into_iter(self) -> I
impl<T> Any for Rev<T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Rev<T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Rev<T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Rev<T>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Rev<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Rev<T>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Rev<T>
impl<T, U> Into<U> for Rev<T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Rev<T>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Rev<T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>