pub trait Context:
Clone
+ Send
+ Sync{
type Store: ReadableKeyValueStore + WritableKeyValueStore + WithError<Error = Self::Error>;
type Extra: Clone + AutoTraits;
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 methods
fn clone_with_base_key(&self, base_key: Vec<u8>) -> Self { ... }
fn clone_with_trimmed_key(&self, n: usize) -> 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 Extra: Clone + AutoTraits
type Extra: Clone + AutoTraits
User-provided data to be carried along.
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.
Sourcefn clone_with_trimmed_key(&self, n: usize) -> Self
fn clone_with_trimmed_key(&self, n: usize) -> Self
Obtains a similar Context implementation with the last n bytes of the base
key trimmed.
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.