Type Alias concordium_contracts_common::HashMap
source · pub type HashMap<K, V, S = FnvBuildHasher> = HashMap<K, V, S>;
Expand description
Reexport of the HashMap
from hashbrown
with the default hasher set to
the fnv
hash function.
Aliased Type§
struct HashMap<K, V, S = FnvBuildHasher> { /* private fields */ }
Trait Implementations§
source§impl<K: Deserial + Hash + Eq, V: Deserial> Deserial for HashMap<K, V>
impl<K: Deserial + Hash + Eq, V: Deserial> Deserial for HashMap<K, V>
The deserialization of maps assumes their size is a u32.
WARNING: Deserialization only ensures that
there are no duplicates. Serializing a HashMap
via its Serial
instance
will not lay out elements in a particular order. As a consequence
deserializing, and serializing back is in general not the identity. This
could have consequences if the data is hashed, or the byte representation
is used in some other way directly. In those cases use a BTreeMap
instead.
source§impl<K: Deserial + Eq + Hash, V: Deserial> DeserialCtx for HashMap<K, V>
impl<K: Deserial + Eq + Hash, V: Deserial> DeserialCtx for HashMap<K, V>
Deserialization for HashMap given a size_len. Keys are not verified to be in any particular order and setting ensure_ordering have no effect.
source§fn deserial_ctx<R: Read>(
size_len: SizeLength,
_ensure_ordered: bool,
source: &mut R
) -> ParseResult<Self>
fn deserial_ctx<R: Read>( size_len: SizeLength, _ensure_ordered: bool, source: &mut R ) -> ParseResult<Self>
source§impl<K: SchemaType, V: SchemaType> SchemaType for HashMap<K, V>
impl<K: SchemaType, V: SchemaType> SchemaType for HashMap<K, V>
source§impl<K: Serial, V: Serial> Serial for HashMap<K, V>
impl<K: Serial, V: Serial> Serial for HashMap<K, V>
The serialization of maps encodes their size as a u32. This should be sufficient for all realistic use cases in smart contracts. They are serialized in no particular order.
source§impl<K: Serial, V: Serial> SerialCtx for HashMap<K, V>
impl<K: Serial, V: Serial> SerialCtx for HashMap<K, V>
Serialization for HashMap given a size_len. Keys are not serialized in any particular order.
source§fn serial_ctx<W: Write>(
&self,
size_len: SizeLength,
out: &mut W
) -> Result<(), W::Err>
fn serial_ctx<W: Write>( &self, size_len: SizeLength, out: &mut W ) -> Result<(), W::Err>
size_length
or
only part of the structure could be written. Read more