pub trait PrimaryKey<'a>: Clone {
    type Prefix: Prefixer<'a>;
    type SubPrefix: Prefixer<'a>;
    type Suffix: KeyDeserialize;
    type SuperSuffix: KeyDeserialize;

    fn key(&self) -> Vec<Key<'_>>;

    fn joined_key(&self) -> Vec<u8> { ... }
    fn joined_extra_key(&self, key: &[u8]) -> Vec<u8> { ... }
Expand description

PrimaryKey needs to be implemented for types that want to be a Map (or Map-like) key, or part of a key.

In particular, it defines a series of types that help iterating over parts of a (composite) key:

Prefix: Prefix is eager. That is, except for empty keys, it’s always “one less” than the full key. Suffix: Suffix is the complement of prefix. SubPrefix: Sub-prefix is “one less” than prefix. SuperSuffix: Super-suffix is “one more” than suffix. The complement of sub-prefix.

By example, for a 2-tuple (T, U):

T: Prefix. U: Suffix. (): Sub-prefix. (T, U): Super-suffix.

SubPrefix and SuperSuffix only make real sense in the case of triples. Still, they need to be consistently defined for all types.

Required Associated Types

These associated types need to implement Prefixer, so that they can be useful arguments for prefix(), sub_prefix(), and their key-deserializable variants.

These associated types need to implement KeyDeserialize, so that they can be returned from range_de() and friends.

Required Methods

returns a slice of key steps, which can be optionally combined

Provided Methods

Implementations on Foreign Types

type safe version to ensure address was validated before use.

owned variant.