Module fadroma::storage

source ·
Expand description

Utilities for interacting with the native key-value storage.



  • A key with an arbitrary number of segments. Writes them in order of the iteration.
  • A key with a pre-defined number of segments. Writes them in order of the iteration.
  • Storage type that stores many items under the given Namespace. The key can be anything that implements Key and the most suitable type of key should be chosen depending on the scenario.
  • Storage type that stores a single item under the given Namespace. Use this when there is only “one of” something.
  • A key which consists of a static byte slice.
  • A strongly-typed key with segments defined by the concrete type which must implement Segment. For typed keys which consist of multiple types use TypedKey2, TypedKey3 and TypedKey4. Constructs the key in order of definition.


  • Implemented for types that act as CW storage keys by writing bytes into the given buffer. What those bytes represent and where they are coming from as well as how they are written into the buffer entirely depends on the implementing type.
  • Represents a namespace, usually acting as a prefix to a dynamically generated key. We only do this so that we can have strongly typed keys and storage types. Use the namespace macro to generate one.
  • Represents types that can be used to construct a TypedKey and its variants. Although it has the exact same method definitions as the Key trait, it differs in its specific usage scenario and as such the two traits are not connected in any way at the type level.


  • Load something from the storage.
  • Remove something from the storage.
  • Save something to the storage.

Type Definitions