pub struct StringSet { /* private fields */ }Expand description
A simple set of strings, implemented using a splay tree.
This is specialised version of Set that stores keys as a string.
Implementations§
Source§impl StringSet
impl StringSet
Sourcepub fn with_capacity(capacity: usize) -> StringSet
pub fn with_capacity(capacity: usize) -> StringSet
Constructor
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional more string/value pairs
Sourcepub fn get(&self, key: &str) -> Option<&str>
pub fn get(&self, key: &str) -> Option<&str>
Get a value by string.
If the string is not in the tree then None is returned.
Sourcepub fn set(&mut self, key: &str)
pub fn set(&mut self, key: &str)
Set a value by string.
set attempts to reconfigure the tree for future lookups by promoting the string to the top
of the tree.
Sourcepub fn unset(&mut self, key: &str)
pub fn unset(&mut self, key: &str)
Unset a value by string.
If the string does not exist, then this function has no effect.
Sourcepub fn iter(&self) -> StringSetIterator<'_> ⓘ
pub fn iter(&self) -> StringSetIterator<'_> ⓘ
Iterate over the string/value pairs in the StringSet
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for StringSet
impl !RefUnwindSafe for StringSet
impl Send for StringSet
impl !Sync for StringSet
impl Unpin for StringSet
impl UnwindSafe for StringSet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more