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 zero(self) -> Self; fn shrink(self) -> Self; fn plus<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.
like clojure
's conj
.
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.
like clojure
's pop
for
vectors and queues.
fn zero(self) -> Self
clear
.
fn shrink(self) -> Self
shrink_to_fit
.
Provided Methods
fn plus<I>(self, coll: I) -> Self where
I: IntoIterator<Item = T>,
I: IntoIterator<Item = T>,
pours another collection into this one.
like clojure
's into
.
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,