[][src]Crate cw_storage

Structs

Bucket
PrefixedStorage
ReadonlyBucket
ReadonlyPrefixedStorage
ReadonlySingleton

ReadonlySingleton only requires a ReadonlyStorage and exposes only the methods of Singleton that don't modify state.

ReadonlyTypedStorage
SeqVal

SeqVal holds a u64 sequence counter but wraps it as a newtype for clarity but mainly to be able to derive NamedType. If named_type included a default derivation for u64 and other primitives, we could just use a u64 here.

Singleton

Singleton effectively combines PrefixedStorage with TypedStorage to work on one single value. It performs the key_prefix transformation on the given name to ensure no collisions, and then provides the standard TypedStorage accessors, without requiring a key (which is defined in the constructor)

TypedStorage

Functions

bucket
bucket_read
currval

currval returns the last value returned by nextval. If the sequence has never been used, then it will return 0.

deserialize
nextval

nextval increments the counter by 1 and returns the new value. On the first time it is called (no sequence info in db) it will return 1.

prefixed
prefixed_read
sequence

Sequence creates a custom Singleton to hold an empty sequence

serialize

serialize makes json bytes, but returns a cosmwasm::Error

singleton
singleton_read
typed
typed_read