Trait ordes::OrdesPop[][src]

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

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

Associated Types

Type of the container after .pop() has been called.

Type of the removed value.

Required methods

Remove the last element from self and return it.

Examples

Using an array:

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

Using a tuple:

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

Implementations on Foreign Types

Implementors