pub struct ViewContext<E, S> { /* private fields */ }Expand description
Implementation of the Context trait on top of a DB client implementing
crate::store::KeyValueStore.
Implementations§
Source§impl<E, S> ViewContext<E, S>where
S: ReadableKeyValueStore + WritableKeyValueStore,
impl<E, S> ViewContext<E, S>where
S: ReadableKeyValueStore + WritableKeyValueStore,
Sourcepub async fn create_root_context(store: S, extra: E) -> Result<Self, S::Error>
pub async fn create_root_context(store: S, extra: E) -> Result<Self, S::Error>
Creates a context suitable for a root view, using the given store. If the journal’s store is non-empty, it will be cleared first, before the context is returned.
Source§impl<E, S> ViewContext<E, S>
impl<E, S> ViewContext<E, S>
Sourcepub fn new_unchecked(store: S, base_key: Vec<u8>, extra: E) -> Self
pub fn new_unchecked(store: S, base_key: Vec<u8>, extra: E) -> Self
Creates a context for the given base key, store, and an extra argument. NOTE: this
constructor doesn’t check the journal of the store. In doubt, use
ViewContext::create_root_context instead.
Source§impl<E> ViewContext<E, MemoryStore>
impl<E> ViewContext<E, MemoryStore>
Sourcepub fn new_for_testing(extra: E) -> Self
pub fn new_for_testing(extra: E) -> Self
Creates a Context instance in memory for testing.
Trait Implementations§
Source§impl<E: Clone, S: Clone> Clone for ViewContext<E, S>
impl<E: Clone, S: Clone> Clone for ViewContext<E, S>
Source§fn clone(&self) -> ViewContext<E, S>
fn clone(&self) -> ViewContext<E, S>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<E, S> Context for ViewContext<E, S>where
E: Clone + AutoTraits,
S: ReadableKeyValueStore + WritableKeyValueStore + Clone,
S::Error: From<Error> + Send + Sync + Error + 'static,
impl<E, S> Context for ViewContext<E, S>where
E: Clone + AutoTraits,
S: ReadableKeyValueStore + WritableKeyValueStore + Clone,
S::Error: From<Error> + Send + Sync + Error + 'static,
Source§impl<E, S> Debug for ViewContext<E, S>
impl<E, S> Debug for ViewContext<E, S>
Auto Trait Implementations§
impl<E, S> Freeze for ViewContext<E, S>
impl<E, S> RefUnwindSafe for ViewContext<E, S>where
S: RefUnwindSafe,
E: RefUnwindSafe,
impl<E, S> Send for ViewContext<E, S>
impl<E, S> Sync for ViewContext<E, S>
impl<E, S> Unpin for ViewContext<E, S>
impl<E, S> UnsafeUnpin for ViewContext<E, S>where
S: UnsafeUnpin,
E: UnsafeUnpin,
impl<E, S> UnwindSafe for ViewContext<E, S>where
S: UnwindSafe,
E: UnwindSafe,
Blanket Implementations§
impl<_INNER> AutoTraits for _INNER
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSync for Twhere
T: Sync,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
impl<M, I> RuntimeMemory<&mut I> for Mwhere
M: RuntimeMemory<I>,
Source§fn read<'instance>(
&self,
instance: &'instance &mut I,
location: GuestPointer,
length: u32,
) -> Result<Cow<'instance, [u8]>, RuntimeError>
fn read<'instance>( &self, instance: &'instance &mut I, location: GuestPointer, length: u32, ) -> Result<Cow<'instance, [u8]>, RuntimeError>
Reads length bytes from memory from the provided location.
Source§fn write(
&mut self,
instance: &mut &mut I,
location: GuestPointer,
bytes: &[u8],
) -> Result<(), RuntimeError>
fn write( &mut self, instance: &mut &mut I, location: GuestPointer, bytes: &[u8], ) -> Result<(), RuntimeError>
Writes the bytes to memory at the provided location.