Crate ink_storage_traits

source ·
Expand description

Traits and interfaces to operate with storage entities.

Generally a type is said to be a storage entity if it implements the Storable trait. This defines certain constants and routines in order to tell a smart contract how to load and store instances of this type from and to the contract’s storage.

The Packed shows that the type can be stored into single storage cell. In most cases, collections(Vec, HashMap, HashSet etc.) work only with packed structures.

If at least one of the type’s fields occupies its own separate storage cell, it is a non-Packed type because it occupies more than one storage cell.

Structs§

  • Auto key type means that the storage key should be calculated automatically.
  • Manual key type specifies the storage key.
  • Resolver key type selects between preferred key and autogenerated key. If the L type is AutoKey it returns auto-generated R else L.

Traits§

  • Automatically returns the type that should be used for storing the value.
  • Trait for describing types that can be read and written to storage while all fields occupy only a single storage cell.
  • Trait for representing types which can be read and written to storage.
  • Describes the type that should be used for storing the value and preferred storage key.
  • Holds storage key for the type.
  • Implemented by types that have a storage layout.

Functions§

  • Decode and consume all of the given input data.