Trait array_tool::vec::Shift [] [src]

pub trait Shift<T> {
    fn shift(&mut self) -> T;
fn unshift(&mut self, other: T); }

Removes, or Adds, the first element of self.

Required Methods

Removes and returns the first item from the vector

Example

use array_tool::vec::Shift;

let mut x = vec![0,1,2,3];
assert_eq!(x.shift(), 0);
assert_eq!(x, vec![1,2,3]);

Insert item at the beginning of the vector. No return value.

Example

use array_tool::vec::Shift;

let mut x = vec![1,2,3];
x.unshift(0);
assert_eq!(x, vec![0,1,2,3]);

Implementations on Foreign Types

impl<T: PartialEq> Shift<T> for Vec<T>
[src]

[src]

[src]

Implementors