Trait protocoll::Seq
[−]
[src]
pub trait Seq<T> where Self: Sized { fn fun<'a>(&'a self) -> Box<Fn(usize) -> Option<&'a T> + 'a>; fn inc(self, i: T) -> Self; fn dec(self) -> Self; fn shrink(self) -> Self; fn empty(self) -> Self; fn absorb<I>(self, coll: I) -> Self where I: IntoIterator<Item=T> { ... } }
basic protocol for seqs.
Required Methods
fn fun<'a>(&'a self) -> Box<Fn(usize) -> Option<&'a T> + 'a>
a seq maps from indices to items. O(n) for BinaryHeap
.
fn inc(self, i: T) -> Self
adds item i
. both Vec
and VecDeque
grows to the right.
fn dec(self) -> Self
removes an item. for Vec
it's the last one; for VecDeque
the first;
for BinaryHeap
it's the greatest one.
fn shrink(self) -> Self
shrink_to_fit
.
fn empty(self) -> Self
clear
.
Provided Methods
fn absorb<I>(self, coll: I) -> Self where I: IntoIterator<Item=T>
takes another collection into this one.
Implementors
impl<T> Seq<T> for Vec<T>
impl<T> Seq<T> for VecDeque<T>
impl<T> Seq<T> for BinaryHeap<T> where T: Ord