Model

Trait Model 

Source
pub trait Model: Serialize + DeserializeOwned {
    type Key: Serialize + DeserializeOwned;
    type Add: Serialize;
    type ObjectStore<'t>: Deref<Target = ObjectStore<'t, Self>> + From<ObjectStore<'t, Self>>;

    const NAME: &'static str;

    // Provided method
    fn with_transaction(
        transaction: &Transaction,
    ) -> Result<Self::ObjectStore<'_>, Error> { ... }
}
Expand description

Trait for defining object stores in an indexed db database

Required Associated Constants§

Source

const NAME: &'static str

Name of the object store

Required Associated Types§

Source

type Key: Serialize + DeserializeOwned

Type of key for the model

Source

type Add: Serialize

Type of value for the model (used to insert operations)

Source

type ObjectStore<'t>: Deref<Target = ObjectStore<'t, Self>> + From<ObjectStore<'t, Self>>

Type of object store for the model

Provided Methods§

Source

fn with_transaction( transaction: &Transaction, ) -> Result<Self::ObjectStore<'_>, Error>

Get a store from given transaction

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§