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§
Required Associated Types§
Sourcetype Key: Serialize + DeserializeOwned
type Key: Serialize + DeserializeOwned
Type of key for the model
Sourcetype ObjectStore<'t>: Deref<Target = ObjectStore<'t, Self>> + From<ObjectStore<'t, Self>>
type ObjectStore<'t>: Deref<Target = ObjectStore<'t, Self>> + From<ObjectStore<'t, Self>>
Type of object store for the model
Provided Methods§
Sourcefn with_transaction(
transaction: &Transaction,
) -> Result<Self::ObjectStore<'_>, Error>
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.