Trait ModelExt

Source
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§

Source

type RedbKey: Key

The redb definition key type(s).

Source

type RedbValue: Value

The redb definition value type(s).

Source

type ModelKey

The model key type(s).

Source

type ModelValue

The model key type(s).

Required Methods§

Source

fn from_values( values: (<Self::RedbKey as Value>::SelfType<'a>, <Self::RedbValue as Value>::SelfType<'a>), ) -> Self

Instantiate from a redb (K, V) pair.

Source

fn from_guards( values: (&AccessGuard<'a, Self::RedbKey>, &AccessGuard<'a, Self::RedbValue>), ) -> Self

Instantiate from a redb (AccessGuard<K>, AccessGuard<V>) pair.

Source

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.

Source

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.

Source

fn as_value(&'a self) -> <Self::RedbValue as Value>::SelfType<'a>

Get the redb V value. May copy, clone or borrow depending on the definition.

Source

fn as_key_and_value( &'a self, ) -> (<Self::RedbKey as Value>::SelfType<'a>, <Self::RedbValue as Value>::SelfType<'a>)

Get all variables as a redb (K, V) pair. 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.

Implementors§