Struct cretonne_codegen::bforest::Set [−][src]
pub struct Set<K, C> where
K: Copy,
C: Comparator<K>, { /* fields omitted */ }
B-tree representing an ordered set of K
s using C
for comparing elements.
This is not a general-purpose replacement for BTreeSet
. See the module
documentation for more information about design tradeoffs.
Sets can be cloned, but that operation should only be used as part of cloning the whole forest they belong to. Cloning a set does not allocate new memory for the clone. It creates an alias of the same memory.
Methods
impl<K, C> Set<K, C> where
K: Copy,
C: Comparator<K>,
[src]
impl<K, C> Set<K, C> where
K: Copy,
C: Comparator<K>,
pub fn new() -> Self
[src]
pub fn new() -> Self
Make an empty set.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Is this an empty set?
pub fn contains(&self, key: K, forest: &SetForest<K, C>, comp: &C) -> bool
[src]
pub fn contains(&self, key: K, forest: &SetForest<K, C>, comp: &C) -> bool
Does the set contain key
?.
pub fn insert(&mut self, key: K, forest: &mut SetForest<K, C>, comp: &C) -> bool
[src]
pub fn insert(&mut self, key: K, forest: &mut SetForest<K, C>, comp: &C) -> bool
Try to insert key
into the set.
If the set did not contain key
, insert it and return true.
If key
is already present, don't change the set and return false.
pub fn remove(&mut self, key: K, forest: &mut SetForest<K, C>, comp: &C) -> bool
[src]
pub fn remove(&mut self, key: K, forest: &mut SetForest<K, C>, comp: &C) -> bool
Remove key
from the set and return true.
If key
was not present in the set, return false.
pub fn clear(&mut self, forest: &mut SetForest<K, C>)
[src]
pub fn clear(&mut self, forest: &mut SetForest<K, C>)
Remove all entries.
pub fn retain<F>(&mut self, forest: &mut SetForest<K, C>, predicate: F) where
F: FnMut(K) -> bool,
[src]
pub fn retain<F>(&mut self, forest: &mut SetForest<K, C>, predicate: F) where
F: FnMut(K) -> bool,
Retains only the elements specified by the predicate.
Remove all elements where the predicate returns false.
pub fn cursor<'a>(
&'a mut self,
forest: &'a mut SetForest<K, C>,
comp: &'a C
) -> SetCursor<'a, K, C>
[src]
pub fn cursor<'a>(
&'a mut self,
forest: &'a mut SetForest<K, C>,
comp: &'a C
) -> SetCursor<'a, K, C>
Create a cursor for navigating this set. The cursor is initially positioned off the end of the set.
ⓘImportant traits for SetIter<'a, K, C>pub fn iter<'a>(&'a self, forest: &'a SetForest<K, C>) -> SetIter<'a, K, C>
[src]
pub fn iter<'a>(&'a self, forest: &'a SetForest<K, C>) -> SetIter<'a, K, C>
Create an iterator traversing this set. The iterator type is K
.
Trait Implementations
impl<K: Clone, C: Clone> Clone for Set<K, C> where
K: Copy,
C: Comparator<K>,
[src]
impl<K: Clone, C: Clone> Clone for Set<K, C> where
K: Copy,
C: Comparator<K>,
fn clone(&self) -> Set<K, C>
[src]
fn clone(&self) -> Set<K, C>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<K, C> Default for Set<K, C> where
K: Copy,
C: Comparator<K>,
[src]
impl<K, C> Default for Set<K, C> where
K: Copy,
C: Comparator<K>,