Struct odds::slice::RevSlice [] [src]

#[repr(C)]
pub struct RevSlice<T>(_);

A reversed view of a slice.

The RevSlice is a random accessible range of elements; it wraps a regular slice but presents the underlying elements in reverse order.

Example

use odds::slice::RevSlice;

let mut data = [0; 8];

{
    let mut rev = <&mut RevSlice<_>>::from(&mut data);
    for (i, elt) in rev.iter_mut().enumerate() {
        *elt = i;
    }

    assert_eq!(&rev[..4], &[0, 1, 2, 3][..]);
}
assert_eq!(&data, &[7, 6, 5, 4, 3, 2, 1, 0]);

Not visible in rustdoc:

Methods

impl<T> RevSlice<T>
[src]

Return the length of the slice.

Get element at index i.

See also indexing notation: &foo[i].

Get element at index i.

See also indexing notation: &mut foo[i].

Return a by-reference iterator

Return a by-mutable-reference iterator

Trait Implementations

impl<T> SliceFind for RevSlice<T>
[src]

Linear search for the first occurrence elt in the slice. Read more

Linear search for the last occurrence elt in the slice. Read more

impl<T: Debug> Debug for RevSlice<T>
[src]

Formats the value using the given formatter.

impl<T: Eq> Eq for RevSlice<T>
[src]

impl<T, U> PartialEq<RevSlice<U>> for RevSlice<T> where
    T: PartialEq<U>, 
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<T, U> PartialEq<[U]> for RevSlice<T> where
    T: PartialEq<U>, 
[src]

RevSlice compares by logical element sequence.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<T> Hash for RevSlice<T> where
    T: Hash
[src]

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.

impl<'a, T, Slice: ?Sized> From<&'a Slice> for &'a RevSlice<T> where
    Slice: AsRef<[T]>, 
[src]

Performs the conversion.

impl<'a, T, Slice: ?Sized> From<&'a mut Slice> for &'a mut RevSlice<T> where
    Slice: AsMut<[T]>, 
[src]

Performs the conversion.

impl<T> Index<usize> for RevSlice<T>
[src]

The returned type after indexing

The method for the indexing (container[index]) operation

impl<T> IndexMut<usize> for RevSlice<T>
[src]

The method for the mutable indexing (container[index]) operation

impl<'a, T> Default for &'a RevSlice<T>
[src]

Returns the "default value" for a type. Read more

impl<'a, T> Default for &'a mut RevSlice<T>
[src]

Returns the "default value" for a type. Read more

impl<T, R> Index<R> for RevSlice<T> where
    R: IndexRange
[src]

The returned type after indexing

The method for the indexing (container[index]) operation

impl<T, R> IndexMut<R> for RevSlice<T> where
    R: IndexRange
[src]

The method for the mutable indexing (container[index]) operation

impl<'a, T> IntoIterator for &'a RevSlice<T>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

impl<'a, T> IntoIterator for &'a mut RevSlice<T>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more