Module storage

Source
Expand description

Utilities for interacting with the native key-value storage.

Modules§

iterable
map

Structs§

CompositeKey
A key with an arbitrary number of segments. Writes them in order of the iteration.
FixedSegmentSizeKey
A key with a pre-defined number of segments. Writes them in order of the iteration.
ItemSpace
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.
SingleItem
Storage type that stores a single item under the given Namespace. Use this when there is only “one of” something.
StaticKey
A key which consists of a static byte slice.
TypedKey
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.
TypedKey2
TypedKey3
TypedKey4

Traits§

Key
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.
Namespace
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.
Segment
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.

Functions§

load
Load something from the storage.
remove
Remove something from the storage.
save
Save something to the storage.

Type Aliases§

Segments