Trait idata::cont::IVec [−][src]
pub trait IVec<T> { fn ipush(self, _: T) -> Self; fn iappend(self, _: Vec<T>) -> Self; fn ipop(self) -> (Option<T>, Self); }
Some operations to work with vectors
Required Methods
fn ipush(self, _: T) -> Self
Push an element to a vector, and return the same vector
extern crate idata; use idata::cont::IVec; fn main() { let v = vec![1, 2]; let v = v.ipush(3) .ipush(4); assert!(v == vec![1,2,3,4]); }
fn iappend(self, _: Vec<T>) -> Self
Append a vector to another
extern crate idata; use idata::cont::IVec; fn main() { let v1 = vec![1, 2]; let v2 = vec![3, 4, 5]; let v1 = v1.iappend(v2); assert!(v1 == vec![1,2,3,4, 5]); }
fn ipop(self) -> (Option<T>, Self)
Remove an element from back of a vector
extern crate idata; use idata::cont::IVec; fn main() { let v1 = vec![1, 2, 3, 4, 5, 6]; let (o, v1) = v1.ipop(); assert!(v1 == vec![1,2,3,4, 5]); assert!(o.unwrap() == 6); }
Implementations on Foreign Types
impl<T> IVec<T> for Vec<T>
[src]
impl<T> IVec<T> for Vec<T>