Struct cw_storage_plus::IndexedMap[][src]

pub struct IndexedMap<'a, K, T, I> where
    K: PrimaryKey<'a>,
    T: Serialize + DeserializeOwned + Clone,
    I: IndexList<T>, 
{ pub idx: I, // some fields omitted }
Expand description

IndexedBucket works like a bucket but has a secondary index TODO: remove traits here and make this const fn new

Fields

idx: I

This is meant to be read directly to get the proper types, like: map.idx.owner.items(…)

Implementations

TODO: remove traits here and make this const fn new

save will serialize the model and store, returns an error on serialization issues. this must load the old value to update the indexes properly if you loaded the old value earlier in the same function, use replace to avoid needless db reads

replace writes data to key. old_data must be the current stored value (from a previous load) and is used to properly update the index. This is used by save, replace, and update and can be called directly if you want to optimize

Loads the data, perform the specified action, and store the result in the database. This is shorthand for some common sequences, which may be useful.

If the data exists, action(Some(value)) is called. Otherwise action(None) is called.

load will return an error if no data is set at the given key, or on parse error

may_load will parse the data stored at the key if present, returns Ok(None) if no data there. returns an error on issues parsing

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.