Trait Context

Source
pub trait Context:
    Clone
    + Send
    + Sync
where ViewError: From<Self::Error>,
{ type Store: ReadableKeyValueStore + WritableKeyValueStore + WithError<Error = Self::Error>; type Extra: Clone + Send + Sync; type Error: KeyValueStoreError; // Required methods fn store(&self) -> &Self::Store; fn extra(&self) -> &Self::Extra; fn base_key(&self) -> &BaseKey; fn base_key_mut(&mut self) -> &mut BaseKey; // Provided method fn clone_with_base_key(&self, base_key: Vec<u8>) -> Self { ... } }
Expand description

The context in which a view is operated. Typically, this includes the client to connect to the database and the address of the current entry.

Required Associated Types§

Source

type Store: ReadableKeyValueStore + WritableKeyValueStore + WithError<Error = Self::Error>

The type of the key-value store used by this context.

Source

type Extra: Clone + Send + Sync

User-provided data to be carried along.

Source

type Error: KeyValueStoreError

The type of errors that may be returned by operations on the Store, a convenience alias for <Self::Store as WithError>::Error.

Required Methods§

Source

fn store(&self) -> &Self::Store

Getter for the store.

Source

fn extra(&self) -> &Self::Extra

Getter for the user-provided data.

Source

fn base_key(&self) -> &BaseKey

Getter for the address of the base key.

Source

fn base_key_mut(&mut self) -> &mut BaseKey

Mutable getter for the address of the base key.

Provided Methods§

Source

fn clone_with_base_key(&self, base_key: Vec<u8>) -> Self

Obtains a similar Context implementation with a different base key.

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§

Source§

impl<E, S> Context for ViewContext<E, S>