[−][src]Struct panoradix::set::RadixSet
A set based on a Radix tree.
See RadixMap
for an in-depth explanation of the workings of this
struct, as it's simply a wrapper around RadixMap<K, ()>
.
Methods
impl<K: Key + ?Sized> RadixSet<K>
[src]
pub fn new() -> RadixSet<K>
[src]
Makes a new empty RadixSet.
Examples
Basic usage:
use panoradix::RadixSet; let mut set = RadixSet::new(); // entries can now be inserted into the empty set set.insert("a");
pub fn clear(&mut self)
[src]
Clears the set, removing all values.
Examples
Basic usage:
use panoradix::RadixSet; let mut set = RadixSet::new(); set.insert("a"); set.clear(); assert!(set.is_empty());
pub fn insert(&mut self, key: &K) -> bool
[src]
Inserts a key into the set.
If the set did not have this key present, true
is returned, otherwise false
is
returned.
Examples
Basic usage:
use panoradix::RadixSet; let mut set = RadixSet::new(); assert_eq!(set.insert("a"), true); assert_eq!(set.is_empty(), false); assert_eq!(set.insert("a"), false);
pub fn contains(&self, key: &K) -> bool
[src]
Returns if the key is present in the set.
Examples
Basic usage:
use panoradix::RadixSet; let mut set = RadixSet::new(); set.insert("a"); assert_eq!(set.contains("a"), true); assert_eq!(set.contains("b"), false);
pub fn is_empty(&self) -> bool
[src]
Returns true
if the set contains no elements.
Examples
Basic usage:
use panoradix::RadixSet; let mut set = RadixSet::new(); assert!(set.is_empty()); set.insert("a"); assert!(!set.is_empty());
pub fn remove(&mut self, key: &K) -> bool
[src]
Removes a key from the set, returning if the key was previously in the map.
Examples
Basic usage:
use panoradix::RadixSet; let mut set = RadixSet::new(); set.insert("a"); assert_eq!(set.remove("a"), true); assert_eq!(set.remove("a"), false);
pub fn iter(&self) -> Iter<K>
[src]
Gets an iterator over the keys inserted (sorted).
Examples
Basic usage:
use panoradix::RadixSet; let mut set = RadixSet::new(); set.insert("c"); set.insert("b"); set.insert("a"); for key in set.iter() { println!("{}", key); } let first_key = set.iter().next().unwrap(); assert_eq!(first_key, "a".to_string());
ⓘImportant traits for Matches<'a, K>pub fn find<'a>(&'a self, key: &K) -> Matches<'a, K>
[src]
Gets an iterator over a filtered subset of the set (sorted).
Note that the full key will be yielded each time, not just the filtered suffix.
Examples
Basic usage:
use panoradix::RadixSet; let mut set = RadixSet::new(); set.insert("abc"); set.insert("acd"); set.insert("abd"); set.insert("bbb"); set.insert("ccc"); for key in set.find("a") { println!("{}", key); } let first_key = set.find("a").next().unwrap(); assert_eq!(first_key, "abc".to_string());
Trait Implementations
impl<K: Key + ?Sized> Default for RadixSet<K>
[src]
impl<K: Key + ?Sized, T: AsRef<K>> FromIterator<T> for RadixSet<K>
[src]
fn from_iter<It>(iter: It) -> Self where
It: IntoIterator<Item = T>,
[src]
It: IntoIterator<Item = T>,
Auto Trait Implementations
impl<K: ?Sized> RefUnwindSafe for RadixSet<K> where
<K as Key>::Component: RefUnwindSafe,
<K as Key>::Component: RefUnwindSafe,
impl<K: ?Sized> Send for RadixSet<K> where
<K as Key>::Component: Send,
<K as Key>::Component: Send,
impl<K: ?Sized> Sync for RadixSet<K> where
<K as Key>::Component: Sync,
<K as Key>::Component: Sync,
impl<K: ?Sized> Unpin for RadixSet<K> where
<K as Key>::Component: Unpin,
<K as Key>::Component: Unpin,
impl<K: ?Sized> UnwindSafe for RadixSet<K> where
<K as Key>::Component: UnwindSafe,
<K as Key>::Component: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,