[−][src]Trait sdset::Collection
This trait is meant to abstract any kind of collection
(i.e. Vec
, HashSet
).
This is particularly helpful when you want particular behavior
when inserting elements, the Counter
struct is a good example
of a custom implementation of the Collection
trait, it is used to only
count the number of elements of a set operation.
Required methods
fn push(&mut self, elem: T)
Insert one element into the collection.
fn extend_from_slice(&mut self, elems: &[T]) where
T: Clone,
T: Clone,
Extend the collection by cloning the elements.
fn extend<I>(&mut self, elems: I) where
I: IntoIterator<Item = T>,
I: IntoIterator<Item = T>,
Extend the collection by inserting the elements from the given Iterator
.
Provided methods
Loading content...Implementations on Foreign Types
impl<T> Collection<T> for Vec<T>
[src]
fn push(&mut self, elem: T)
[src]
fn extend_from_slice(&mut self, elems: &[T]) where
T: Clone,
[src]
T: Clone,
fn extend<I>(&mut self, elems: I) where
I: IntoIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,
fn reserve(&mut self, size: usize)
[src]
impl<T: Hash + Eq> Collection<T> for HashSet<T>
[src]
fn push(&mut self, elem: T)
[src]
fn extend_from_slice(&mut self, elems: &[T]) where
T: Clone,
[src]
T: Clone,
fn extend<I>(&mut self, elems: I) where
I: IntoIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,
fn reserve(&mut self, size: usize)
[src]
impl<T: Ord> Collection<T> for BTreeSet<T>
[src]
fn push(&mut self, elem: T)
[src]
fn extend_from_slice(&mut self, elems: &[T]) where
T: Clone,
[src]
T: Clone,
fn extend<I>(&mut self, elems: I) where
I: IntoIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,
Implementors
impl<T> Collection<T> for Counter
[src]
fn push(&mut self, _elem: T)
[src]
fn extend_from_slice(&mut self, elems: &[T]) where
T: Clone,
[src]
T: Clone,
fn extend<I>(&mut self, elems: I) where
I: IntoIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,