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

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.

Returns the number of elements in the store

Returns true if the store contains no elements

Clears the store, removing all elements

Checks whether a value matching the specified key exists

Get the TypeId of a stored value

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.

Inserts a key-value pair into the store

Returns the corresponding TaggedKey for convenience.

Unlike HashMap this does not return any displaced old value since the type of any such value is unknown.

Inserts a key and boxed value pair

Returns the corresponding TaggedKey for convenience.

Unlike HashMap this does not return any displaced old value since the type of any such value is unknown.

Removes and returns a value, if present

Panics on type mismatch.

Removes and returns a value, if present

Panics on type mismatch.

Get key’s entry for in-place manipulation

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.