pub struct LazyHashMap<K, V, H> { /* private fields */ }
Expand description

A lazy storage mapping that stores entries under their SCALE encoded key hashes.

Note

This is mainly used as low-level storage primitives by other high-level storage primitives in order to manage the contract storage for a whole mapping of storage cells.

This storage data structure might store its entries anywhere in the contract storage. It is the users responsibility to keep track of the entries if it is necessary to do so.

Implementations

Creates a new empty lazy hash map.

Note

A lazy map created this way cannot be used to load from the contract storage. All operations that directly or indirectly load from storage will panic.

Returns the offset key of the lazy map if any.

Puts the new value under the given key.

Note
Panics
  • If the lazy hash map is in an invalid state that forbids interaction with the underlying contract storage.
  • If the decoding of the old element at the given index failed.

Gets the given key’s corresponding entry in the map for in-place manipulation.

Clears the underlying storage of the entry at the given index.

Safety

For performance reasons this does not synchronize the lazy index map’s memory-side cache which invalidates future accesses the cleared entry. Care should be taken when using this API.

The general use of this API is to streamline Drop implementations of high-level abstractions that build upon this low-level data structure.

Returns a shared reference to the value associated with the given key if any.

Panics
  • If the lazy chunk is in an invalid state that forbids interaction.
  • If the decoding of the element at the given index failed.

Returns an exclusive reference to the value associated with the given key if any.

Panics
  • If the lazy chunk is in an invalid state that forbids interaction.
  • If the decoding of the element at the given index failed.

Puts the new value under the given key and returns the old value if any.

Note
Panics
  • If the lazy hashmap is in an invalid state that forbids interaction.
  • If the decoding of the old element at the given index failed.

Swaps the values at entries with associated keys x and y.

This operation tries to be as efficient as possible and reuse allocations.

Panics
  • If the lazy hashmap is in an invalid state that forbids interaction.
  • If the decoding of one of the elements failed.

Trait Implementations

Formats the value using the given formatter. Read more

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

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

Creates a value from an iterator. Read more

Default initializes the implementing type using spread layout. Read more

The footprint of the type. Read more

Pulls an instance of Self from the contract storage. Read more

Pushes an instance of Self to the contract storage. Read more

Clears an instance of Self from the contract storage. Read more

Indicates whether a type requires deep clean-up of its state meaning that a clean-up routine has to decode an entity into an instance in order to eventually recurse upon its tear-down. This is not required for the majority of primitive data types such as i32, however types such as storage::Box that might want to forward the clean-up procedure to their inner T require a deep clean-up. Read more

Returns the static storage layout of Self. 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.