pub trait Context:
Clone
+ Send
+ Sync{
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§
Sourcetype Store: ReadableKeyValueStore + WritableKeyValueStore + WithError<Error = Self::Error>
type Store: ReadableKeyValueStore + WritableKeyValueStore + WithError<Error = Self::Error>
The type of the key-value store used by this context.
Sourcetype Error: KeyValueStoreError
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§
Sourcefn base_key_mut(&mut self) -> &mut BaseKey
fn base_key_mut(&mut self) -> &mut BaseKey
Mutable getter for the address of the base key.
Provided Methods§
Sourcefn clone_with_base_key(&self, base_key: Vec<u8>) -> Self
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.