Struct protocoll::set::VecSortedSet
[−]
[src]
pub struct VecSortedSet<T>(_);
an array-set. very efficient for small sets.
Methods
impl<T> VecSortedSet<T> where
T: Ord,
[src]
T: Ord,
fn new() -> Self
fn with_capacity(n: usize) -> Self
fn capacity(&self) -> usize
fn reserve(&mut self, n: usize)
fn shrink_to_fit(&mut self)
fn clear(&mut self)
fn contains<Q: ?Sized>(&self, e: &Q) -> bool where
T: Borrow<Q>,
Q: Ord,
T: Borrow<Q>,
Q: Ord,
O(log(len))
fn get<Q: ?Sized>(&self, e: &Q) -> Option<&T> where
T: Borrow<Q>,
Q: Ord,
T: Borrow<Q>,
Q: Ord,
O(log(len))
fn get_mut<Q: ?Sized>(&mut self, e: &Q) -> Option<&mut T> where
T: Borrow<Q>,
Q: Ord,
T: Borrow<Q>,
Q: Ord,
O(log(len))
fn insert(&mut self, e: T) -> Option<T>
O(log(len)) when e
already exists. O(len) for inserting a new element,
caused by shifting all elements after it, which can be avoided by always
inserting in order.
fn remove<Q: ?Sized>(&mut self, e: &Q) -> Option<T> where
T: Borrow<Q>,
Q: Ord,
T: Borrow<Q>,
Q: Ord,
O(log(len)) when e
does not exist. O(len) for removing an element,
because of the need for shifting all elements after it.
fn append(&mut self, other: &mut VecSortedSet<T>)
fn reserve_exact(&mut self, n: usize)
fn pop(&mut self) -> Option<T>
fn truncate(&mut self, n: usize)
fn retain<F>(&mut self, f: F) where
F: FnMut(&T) -> bool,
F: FnMut(&T) -> bool,
fn split_off(&mut self, at: usize) -> VecSortedSet<T>
fn is_disjoint(&self, other: &VecSortedSet<T>) -> bool
fn is_subset(&self, other: &VecSortedSet<T>) -> bool
fn is_superset(&self, other: &VecSortedSet<T>) -> bool
fn union<'a>(&'a self, other: &'a VecSortedSet<T>) -> Union<'a, T>
fn intersection<'a>(&'a self, other: &'a VecSortedSet<T>) -> Intersection<'a, T>
fn difference<'a>(&'a self, other: &'a VecSortedSet<T>) -> Difference<'a, T>
fn symmetric_difference<'a>(
&'a self,
other: &'a VecSortedSet<T>
) -> SymmetricDifference<'a, T>
&'a self,
other: &'a VecSortedSet<T>
) -> SymmetricDifference<'a, T>
impl<T> VecSortedSet<T>
[src]
fn view_content<'a>(&'a self) -> &'a Vec<T>
a view for the underlying vec. &self
methods for Vec
such as get
and split
can be accessed through this.
fn iter(&self) -> Iter<T>
iterate over the underlying vec.
fn len(&self) -> usize
fn is_empty(&self) -> bool
Trait Implementations
impl<T: Default> Default for VecSortedSet<T>
[src]
fn default() -> VecSortedSet<T>
Returns the "default value" for a type. Read more
impl<T: Clone> Clone for VecSortedSet<T>
[src]
fn clone(&self) -> VecSortedSet<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<T: PartialEq> PartialEq for VecSortedSet<T>
[src]
fn eq(&self, __arg_0: &VecSortedSet<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &VecSortedSet<T>) -> bool
This method tests for !=
.
impl<T: Eq> Eq for VecSortedSet<T>
[src]
impl<T: PartialOrd> PartialOrd for VecSortedSet<T>
[src]
fn partial_cmp(&self, __arg_0: &VecSortedSet<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &VecSortedSet<T>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &VecSortedSet<T>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &VecSortedSet<T>) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &VecSortedSet<T>) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: Ord> Ord for VecSortedSet<T>
[src]
fn cmp(&self, __arg_0: &VecSortedSet<T>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<T: Hash> Hash for VecSortedSet<T>
[src]
fn hash<__HT: Hasher>(&self, __arg_0: &mut __HT)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T> IntoIterator for VecSortedSet<T>
[src]
type Item = T
The type of the elements being iterated over.
type IntoIter = IntoIter<T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> IntoIter<T>
Creates an iterator from a value. Read more
impl<'a, T: 'a> IntoIterator for &'a VecSortedSet<T>
[src]
type Item = &'a T
The type of the elements being iterated over.
type IntoIter = Iter<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Iter<'a, T>
Creates an iterator from a value. Read more
impl<T> Extend<T> for VecSortedSet<T> where
T: Ord,
[src]
T: Ord,
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = T>,
I: IntoIterator<Item = T>,
Extends a collection with the contents of an iterator. Read more
impl<'a, T> Extend<&'a T> for VecSortedSet<T> where
T: Ord + Copy,
[src]
T: Ord + Copy,
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = &'a T>,
I: IntoIterator<Item = &'a T>,
Extends a collection with the contents of an iterator. Read more
impl<T> FromIterator<T> for VecSortedSet<T> where
T: Ord,
[src]
T: Ord,
fn from_iter<I>(iter: I) -> VecSortedSet<T> where
I: IntoIterator<Item = T>,
I: IntoIterator<Item = T>,
Creates a value from an iterator. Read more
impl<'a, T, Q: ?Sized> Index<&'a Q> for VecSortedSet<T> where
T: Ord,
T: Borrow<Q>,
Q: Ord,
[src]
T: Ord,
T: Borrow<Q>,
Q: Ord,
type Output = T
The returned type after indexing
fn index(&self, k: &Q) -> &T
The method for the indexing (container[index]
) operation
impl<T> Debug for VecSortedSet<T> where
T: Ord + Debug,
[src]
T: Ord + Debug,
impl<T> Set<T> for VecSortedSet<T> where
T: Ord,
[src]
T: Ord,
fn fun<'a, Q: ?Sized>(&'a self) -> Box<Fn(&Q) -> Option<&'a T> + 'a> where
T: Borrow<Q>,
Q: Ord,
T: Borrow<Q>,
Q: Ord,
a set maps from items to themselves.
fn inc(self, i: T) -> Self
adds item i
. Read more
fn dec<Q: ?Sized>(self, i: &Q) -> Self where
T: Borrow<Q>,
Q: Ord,
T: Borrow<Q>,
Q: Ord,
removes item i
. Read more
fn zero(self) -> Self
clear
.
fn shrink(self) -> Self
shrink_to_fit
.
fn plus<I>(self, coll: I) -> Self where
I: IntoIterator<Item = T>,
I: IntoIterator<Item = T>,
pours another collection into this one. Read more
impl<T> BitOr<VecSortedSet<T>> for VecSortedSet<T> where
T: Ord,
[src]
T: Ord,
type Output = VecSortedSet<T>
The resulting type after applying the |
operator
fn bitor(self, other: VecSortedSet<T>) -> VecSortedSet<T>
union.
example
use protocoll::set::VecSortedSet; let s1:VecSortedSet<_> = vec![1,2,3].into_iter().collect(); let s2:VecSortedSet<_> = vec![2,3,4].into_iter().collect(); assert_eq!((s1 | s2).view_content(), &[1,2,3,4]);
impl<'a, 'b, T> BitOr<&'b VecSortedSet<T>> for &'a VecSortedSet<T> where
T: Ord + Clone,
[src]
T: Ord + Clone,
type Output = VecSortedSet<T>
The resulting type after applying the |
operator
fn bitor(self, other: &VecSortedSet<T>) -> VecSortedSet<T>
union with cloned members.
example
use protocoll::set::VecSortedSet; let s1:VecSortedSet<_> = vec![1,2,3].into_iter().collect(); let s2:VecSortedSet<_> = vec![2,3,4].into_iter().collect(); assert_eq!((&s1 | &s2).view_content(), &[1,2,3,4]);
impl<T> BitAnd<VecSortedSet<T>> for VecSortedSet<T> where
T: Ord,
[src]
T: Ord,
type Output = VecSortedSet<T>
The resulting type after applying the &
operator
fn bitand(self, other: VecSortedSet<T>) -> VecSortedSet<T>
intersection.
example
use protocoll::set::VecSortedSet; let s1:VecSortedSet<_> = vec![1,2,3].into_iter().collect(); let s2:VecSortedSet<_> = vec![2,3,4].into_iter().collect(); assert_eq!((s1 & s2).view_content(), &[2,3]);
impl<'a, 'b, T> BitAnd<&'b VecSortedSet<T>> for &'a VecSortedSet<T> where
T: Ord + Clone,
[src]
T: Ord + Clone,
type Output = VecSortedSet<T>
The resulting type after applying the &
operator
fn bitand(self, other: &VecSortedSet<T>) -> VecSortedSet<T>
intersection with cloned members.
example
use protocoll::set::VecSortedSet; let s1:VecSortedSet<_> = vec![1,2,3].into_iter().collect(); let s2:VecSortedSet<_> = vec![2,3,4].into_iter().collect(); assert_eq!((&s1 & &s2).view_content(), &[2,3]);
impl<T> Sub<VecSortedSet<T>> for VecSortedSet<T> where
T: Ord,
[src]
T: Ord,
type Output = VecSortedSet<T>
The resulting type after applying the -
operator
fn sub(self, other: VecSortedSet<T>) -> VecSortedSet<T>
difference.
example
use protocoll::set::VecSortedSet; let s1:VecSortedSet<_> = vec![1,2,3].into_iter().collect(); let s2:VecSortedSet<_> = vec![2,3,4].into_iter().collect(); assert_eq!((s1 - s2).view_content(), &[1]);
impl<'a, 'b, T> Sub<&'b VecSortedSet<T>> for &'a VecSortedSet<T> where
T: Ord + Clone,
[src]
T: Ord + Clone,
type Output = VecSortedSet<T>
The resulting type after applying the -
operator
fn sub(self, other: &VecSortedSet<T>) -> VecSortedSet<T>
difference with cloned members.
example
use protocoll::set::VecSortedSet; let s1:VecSortedSet<_> = vec![1,2,3].into_iter().collect(); let s2:VecSortedSet<_> = vec![2,3,4].into_iter().collect(); assert_eq!((&s1 - &s2).view_content(), &[1]);
impl<T> BitXor<VecSortedSet<T>> for VecSortedSet<T> where
T: Ord,
[src]
T: Ord,
type Output = VecSortedSet<T>
The resulting type after applying the ^
operator
fn bitxor(self, other: VecSortedSet<T>) -> VecSortedSet<T>
symmetric difference.
example
use protocoll::set::VecSortedSet; let s1:VecSortedSet<_> = vec![1,2,3].into_iter().collect(); let s2:VecSortedSet<_> = vec![2,3,4].into_iter().collect(); assert_eq!((s1 ^ s2).view_content(), &[1,4]);
impl<'a, 'b, T> BitXor<&'b VecSortedSet<T>> for &'a VecSortedSet<T> where
T: Ord + Clone,
[src]
T: Ord + Clone,
type Output = VecSortedSet<T>
The resulting type after applying the ^
operator
fn bitxor(self, other: &VecSortedSet<T>) -> VecSortedSet<T>
symmetric difference with cloned members.
example
use protocoll::set::VecSortedSet; let s1:VecSortedSet<_> = vec![1,2,3].into_iter().collect(); let s2:VecSortedSet<_> = vec![2,3,4].into_iter().collect(); assert_eq!((&s1 ^ &s2).view_content(), &[1,4]);