Module ink_storage::traits [−][src]
Expand description
Traits and interfaces to operate with storage entities.
Generally a type is said to be a storage entity if it implements the
SpreadLayout
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 PackedLayout
trait can then be implemented on top of the SpreadLayout
for types that further allow to be stored in the contract storage in a more
compressed format to a single storage cell.
Structs
A key pointer.
Constants
This constant is used by some types to make sure that cleaning up behind them won’t become way too expensive. Since we are missing Substrate’s storage bulk removal feature we cannot do better than this at the moment. The number is arbitrarily chosen. Might need adjustments later.
Traits
Extension trait to make KeyPtr
simpler to use for T: SpreadLayout
types.
Types implementing this trait are supported layouting crypto hashers.
Types that can be stored to and loaded from a single contract storage cell.
Types that can be stored to and loaded from the contract storage.
Implemented by types that have a storage layout.
Functions
Clears the entity from the contract storage using packed layout.
Clears the entity from the contract storage using spread layout.
Clears an instance of type T
in packed fashion from the contract storage.
Pulls an instance of type T
in packed fashion from the contract storage.
Pushes an instance of type T
in packed fashion to the contract storage.
Pulls an instance of type T
from the contract storage using packed layout.
Pulls an instance of type T
from the contract storage using spread layout.
Pushes the entity to the contract storage using packed layout.
Pushes the entity to the contract storage using spread layout.
Derive Macros
Derives ink_storage
’s PackedLayout
trait for the given struct
or enum
.
Derives ink_storage
’s SpreadLayout
trait for the given struct
or enum
.
Derives ink_storage
’s StorageLayout
trait for the given struct
or enum
.