Trait ordes::OrdesRest[][src]

pub trait OrdesRest {
    type Newlen;
    type Output;
    fn rest(self) -> (Self::Newlen, Self::Output);
}
Expand description

Trait for defining the removal of the first element from an array- or tuple-like data structure.

Associated Types

Required methods

Removes the first element from self and returns it.

Examples

Using an array:

let foo: [u8; 5] = [0, 1, 2, 3, 4];
let (foo, pop) = foo.rest();
assert_eq!(foo, [1, 2, 3, 4]);
assert_eq!(pop, 0);

Using a tuple:

let foo = ('a', false, b'c', "d");
let (foo, pop) = foo.rest();
assert_eq!(foo, (false, b'c', "d"));
assert_eq!(pop, 'a');

Implementations on Foreign Types

Implementors