pub trait AsContext {
type Data: 'static;
// Required method
fn as_context(&self) -> StoreContext<'_, Self::Data>;
}
Expand description
A trait used to get shared access to a Store
in Wasmtime.
This trait is used as a bound on the first argument of many methods within
Wasmtime. This trait is implemented for types like Store
,
Caller
, and StoreContext
itself. Implementors of this
trait provide access to a StoreContext
via some means, allowing the
method in question to get access to the store’s internal information.
Note that this is only used in contexts where the store’s information is
read, but not written. For example methods that return type information will
use this trait as a bound. More commonly, though, mutation is required and
AsContextMut
is needed.
Required Associated Types§
Required Methods§
Sourcefn as_context(&self) -> StoreContext<'_, Self::Data>
fn as_context(&self) -> StoreContext<'_, Self::Data>
Returns the store context that this type provides access to.
Implementations on Foreign Types§
Source§impl<T: AsContext> AsContext for &T
Available on crate feature runtime
only.
impl<T: AsContext> AsContext for &T
Available on crate feature
runtime
only.type Data = <T as AsContext>::Data
fn as_context(&self) -> StoreContext<'_, T::Data>
Source§impl<T: AsContext> AsContext for &mut T
Available on crate feature runtime
only.
impl<T: AsContext> AsContext for &mut T
Available on crate feature
runtime
only.type Data = <T as AsContext>::Data
fn as_context(&self) -> StoreContext<'_, T::Data>
Implementors§
Source§impl<'a, T, D> AsContext for Access<'a, T, D>
Available on crate features component-model-async
and component-model
and runtime
only.
impl<'a, T, D> AsContext for Access<'a, T, D>
Available on crate features
component-model-async
and component-model
and runtime
only.Source§impl<T> AsContext for RootScope<T>where
T: AsContextMut,
Available on crate features gc
and runtime
only.
impl<T> AsContext for RootScope<T>where
T: AsContextMut,
Available on crate features
gc
and runtime
only.Source§impl<T: 'static> AsContext for StoreContext<'_, T>
Available on crate feature runtime
only.
impl<T: 'static> AsContext for StoreContext<'_, T>
Available on crate feature
runtime
only.