pub struct DroplessInternSet<S = FxBuildHasher> { /* private fields */ }Expand description
A dropless interner.
Interning on this type always copies the given value into internal buffer.
Implementations§
Source§impl<S: BuildHasher> DroplessInternSet<S>
impl<S: BuildHasher> DroplessInternSet<S>
pub fn with_hasher(hash_builder: S) -> Self
pub fn intern<K: Dropless + ?Sized>(&mut self, value: &K) -> Interned<'_, K>
pub fn intern_formatted_str<K: Display + ?Sized>( &mut self, value: &K, upper_size: usize, ) -> Result<Interned<'_, str>, Error>
Sourcepub fn get<K: Dropless + ?Sized>(&self, value: &K) -> Option<Interned<'_, K>>
pub fn get<K: Dropless + ?Sized>(&self, value: &K) -> Option<Interned<'_, K>>
§Eaxmples
use any_intern::DroplessInternSet;
use std::hash::RandomState;
let mut set = DroplessInternSet::with_hasher(RandomState::new());
set.intern("hello");
assert_eq!(set.get("hello").as_deref(), Some("hello"));
assert!(set.get("hi").is_none());pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn clear(&mut self)
Trait Implementations§
Source§impl<S: Debug> Debug for DroplessInternSet<S>
impl<S: Debug> Debug for DroplessInternSet<S>
Source§impl<S: Default> Default for DroplessInternSet<S>
impl<S: Default> Default for DroplessInternSet<S>
Source§fn default() -> DroplessInternSet<S>
fn default() -> DroplessInternSet<S>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<S = BuildHasherDefault<FxHasher>> !Freeze for DroplessInternSet<S>
impl<S = BuildHasherDefault<FxHasher>> !RefUnwindSafe for DroplessInternSet<S>
impl<S = BuildHasherDefault<FxHasher>> !Send for DroplessInternSet<S>
impl<S = BuildHasherDefault<FxHasher>> !Sync for DroplessInternSet<S>
impl<S> Unpin for DroplessInternSet<S>where
S: Unpin,
impl<S = BuildHasherDefault<FxHasher>> !UnwindSafe for DroplessInternSet<S>
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