[−][src]Struct prefix_tree::PrefixTreeSet
A set implemented as a PrefixTreeMap where the value is ().
Methods
impl<T: Eq + Clone> PrefixTreeSet<T>[src]
pub fn new() -> PrefixTreeSet<T>[src]
Creates an empty PrefixTreeSet.
Examples
use prefix_tree::PrefixTreeSet; let mut set: PrefixTreeSet<u8> = PrefixTreeSet::new();
pub fn clear(&mut self)[src]
Clears the set, removing all key-value pairs.
Examples
use prefix_tree::PrefixTreeSet; let mut set: PrefixTreeSet<u8> = PrefixTreeSet::new(); set.insert("foo"); set.clear(); assert!(set.is_empty());
pub fn contains<Q>(&self, key: Q) -> bool where
Q: AsRef<[T]>, [src]
Q: AsRef<[T]>,
Returns true if the set contains a value.
Examples
use prefix_tree::PrefixTreeSet; let mut set: PrefixTreeSet<u8> = PrefixTreeSet::new(); set.insert("1"); assert_eq!(set.contains("1"), true); assert_eq!(set.contains("2"), false);
pub fn insert<Q>(&mut self, key: Q) -> bool where
Q: AsRef<[T]>, [src]
Q: AsRef<[T]>,
Adds a value to the set.
Examples
use prefix_tree::PrefixTreeSet; let mut set: PrefixTreeSet<u8> = PrefixTreeSet::new(); assert_eq!(set.insert("1"), true); assert_eq!(set.insert("1"), false); assert_eq!(set.contains("1"), true);
pub fn is_empty(&self) -> bool[src]
Returns true if the set contains no elements.
Examples
use prefix_tree::PrefixTreeSet; let mut set: PrefixTreeSet<u8> = PrefixTreeSet::new(); assert_eq!(set.is_empty(), true); set.insert("foo"); assert_eq!(set.is_empty(), false);
pub fn len(&self) -> usize[src]
Returns the number of elements in the set.
Examples
use prefix_tree::PrefixTreeSet; let mut set: PrefixTreeSet<u8> = PrefixTreeSet::new(); assert_eq!(set.len(), 0); set.insert("foo"); assert_eq!(set.len(), 1);
Trait Implementations
impl<T: Debug> Debug for PrefixTreeSet<T>[src]
impl<T: Default> Default for PrefixTreeSet<T>[src]
fn default() -> PrefixTreeSet<T>[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for PrefixTreeSet<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for PrefixTreeSet<T> where
T: Send,
T: Send,
impl<T> Sync for PrefixTreeSet<T> where
T: Sync,
T: Sync,
impl<T> Unpin for PrefixTreeSet<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for PrefixTreeSet<T> where
T: UnwindSafe,
T: 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>,