pub trait ModelExt<'a>:
Model<'a>
+ Sized
+ 'a {
type RedbKey: Key;
type RedbValue: Value;
type ModelKey;
type ModelValue;
// Required methods
fn from_values(
values: (<Self::RedbKey as Value>::SelfType<'a>, <Self::RedbValue as Value>::SelfType<'a>),
) -> Self;
fn from_guards(
values: (&AccessGuard<'a, Self::RedbKey>, &AccessGuard<'a, Self::RedbValue>),
) -> Self;
fn from_key_and_guard(
values: (<Self::RedbKey as Value>::SelfType<'a>, &AccessGuard<'a, Self::RedbValue>),
) -> Self;
fn as_key(&'a self) -> <Self::RedbKey as Value>::SelfType<'a>;
fn as_value(&'a self) -> <Self::RedbValue as Value>::SelfType<'a>;
fn as_key_and_value(
&'a self,
) -> (<Self::RedbKey as Value>::SelfType<'a>, <Self::RedbValue as Value>::SelfType<'a>);
}
Expand description
Conversion methods for a Model
and the associated keys and values.
Required Associated Types§
Sourcetype ModelValue
type ModelValue
The model key type(s).
Required Methods§
Sourcefn from_values(
values: (<Self::RedbKey as Value>::SelfType<'a>, <Self::RedbValue as Value>::SelfType<'a>),
) -> Self
fn from_values( values: (<Self::RedbKey as Value>::SelfType<'a>, <Self::RedbValue as Value>::SelfType<'a>), ) -> Self
Instantiate from a redb
(K
, V
) pair.
Sourcefn from_guards(
values: (&AccessGuard<'a, Self::RedbKey>, &AccessGuard<'a, Self::RedbValue>),
) -> Self
fn from_guards( values: (&AccessGuard<'a, Self::RedbKey>, &AccessGuard<'a, Self::RedbValue>), ) -> Self
Instantiate from a redb
(AccessGuard<K>
, AccessGuard<V>
) pair.
Sourcefn from_key_and_guard(
values: (<Self::RedbKey as Value>::SelfType<'a>, &AccessGuard<'a, Self::RedbValue>),
) -> Self
fn from_key_and_guard( values: (<Self::RedbKey as Value>::SelfType<'a>, &AccessGuard<'a, Self::RedbValue>), ) -> Self
Instantiate from a redb
(K
, AccessGuard<V>
) pair.
Sourcefn as_key(&'a self) -> <Self::RedbKey as Value>::SelfType<'a>
fn as_key(&'a self) -> <Self::RedbKey as Value>::SelfType<'a>
Get the redb
K
value. May copy, clone or borrow
depending on the definition.
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.