Struct cw_storage_plus::UniqueIndex[][src]

pub struct UniqueIndex<'a, K, T> { /* fields omitted */ }
Expand description

UniqueIndex stores (namespace, index_name, idx_value) -> {key, value} Allows one value per index (i.e. unique) and copies pk and data

Implementations

Create a new UniqueIndex

idx_fn - lambda creating index key from index value idx_namespace - prefix for the index value

Example:
use cw_storage_plus::{U32Key, UniqueIndex};

struct Data {
    pub name: String,
    pub age: u32,
}

UniqueIndex::new(|d: &Data| U32Key::new(d.age), "data__age");

returns all items that match this secondary index, always by pk Ascending

Trait Implementations

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.