Struct polystore::HashMap [−][src]
pub struct HashMap<K, S>(_);
Expand description
Polymorphic hash map
Internally this uses a HashMap
with boxed values, thus performance is
much like that of HashMap
.
Note: HashMap
’s capacity reservation API is excluded. There is no
fundamental reason for this, other than each stored value requiring an
allocation (boxing) anyway.
Warning
Warning: values stored in the map will not have their destructor
(Drop::drop
) run when the map is destroyed. This is not currently
fixable (min_specialization
+
https://github.com/rust-lang/rust/issues/46893 may be sufficient).
Implementations
Construct a new store with the given hash bulider
Return’s a reference to the map’s BuildHasher
Returns an iterator over all keys in arbitrary order
These are not tagged keys; only the bare key is stored.
Checks whether a value matching the specified key
exists
Returns a reference to the value corresponding to the key
The value’s type is inferred from the TaggedKey
.
Returns None
if no element matches tag
or if the type V
does not match the element.
Returns a reference to the value corresponding to the key
The value’s type must be specified explicitly.
Returns None
if no element matches key
. Panics on type mismatch.
Returns a mutable reference to the value corresponding to the key
Returns a mutable reference to the value corresponding to the key
Returns None
if no element matches key
. Panics on type mismatch.
pub fn insert_boxed<V: 'static>(
&mut self,
key: K,
value: Box<V>
) -> TaggedKey<K, V> where
K: Clone,
pub fn insert_boxed<V: 'static>(
&mut self,
key: K,
value: Box<V>
) -> TaggedKey<K, V> where
K: Clone,
Removes and returns a value, if present
Panics on type mismatch.
Removes and returns a value, if present
Panics on type mismatch.
Trait Implementations
Auto Trait Implementations
impl<K, S> !RefUnwindSafe for HashMap<K, S>
impl<K, S> !UnwindSafe for HashMap<K, S>