Struct near_sdk::collections::UnorderedMap[][src]

pub struct UnorderedMap<K, V> { /* fields omitted */ }
Expand description

An iterable implementation of a map that stores its content directly on the trie.

Implementations

Returns the number of elements in the map, also referred to as its size.

Returns true if the map contains no elements.

Create new map with zero elements. Use prefix as a unique identifier.

Inserts a serialized key-value pair into the map. If the map did not have this key present, None is returned. Otherwise returns a serialized value. Note, the keys that have the same hash value are undistinguished by the implementation.

Removes a serialized key from the map, returning the serialized value at the key if the key was previously in the map.

Returns the value corresponding to the key.

Removes a key from the map, returning the value at the key if the key was previously in the map.

Inserts a key-value pair into the map. If the map did not have this key present, None is returned. Otherwise returns a value. Note, the keys that have the same hash value are undistinguished by the implementation.

Clears the map, removing all elements.

Copies elements into an std::vec::Vec.

An iterator visiting all keys. The iterator element type is K.

An iterator visiting all values. The iterator element type is V.

Iterate over deserialized keys and values.

Returns a view of keys as a vector. It’s sometimes useful to have random access to the keys.

Returns a view of values as a vector. It’s sometimes useful to have random access to the values.

Trait Implementations

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes. Read more

Deserialize this instance from a slice of bytes.

Whether Self is u8. NOTE: Vec<u8> is the most common use-case for serialization and deserialization, it’s worth handling it as a special case to improve performance. It’s a workaround for specific Vec<u8> implementation versus generic Vec<T> implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details. Read more

Serialize this instance into a vector of bytes.

Whether Self is u8. NOTE: Vec<u8> is the most common use-case for serialization and deserialization, it’s worth handling it as a special case to improve performance. It’s a workaround for specific Vec<u8> implementation versus generic Vec<T> implementation. See https://github.com/rust-lang/rfcs/pull/1210 for details. 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.

Should always be Self

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.