[][src]Crate rev_slice

Offers a reversed view into a slice.

To use, import the SliceExt trait to get the .rev() and .rev_mut extension methods on slices. Then treat the returned RevSlice like you would an ordinary slice: index it, split it, iterate it, whatever.

Example:

extern crate rev_slice;
use rev_slice::SliceExt;

let r = [1, 2, 4, 9, 16, 25].rev();
assert_eq!(r[0], 25);
assert_eq!(r[1..3].rev(), &[9, 16]);
assert_eq!(r.split_first().unwrap().0, &25);

let mut it = r.iter().cloned().skip(2);
assert_eq!(it.next(), Some(9));
assert_eq!(it.next(), Some(4));
assert_eq!(it.next(), Some(2));

Structs

RevSlice

A DST newtype providing a reversed view of a slice.

Traits

SliceExt

Adds .rev() and .rev_mut() methods to slices.