pub struct LazyIndexMap<V> { /* private fields */ }
Expand description

A lazy storage chunk that spans over a whole chunk of storage cells.

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 chunk of storage cells.

A chunk of storage cells is a contiguous range of 2^32 storage cells.

Implementations

Creates a new empty lazy 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 at the given index.

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

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 an offset key for the given index.

Returns a shared reference to the element at the given index 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 element at the given index 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 at the given index and returns the old value if any.

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

Swaps the values at indices x and y.

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

Panics
  • If the lazy chunk 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

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.