Trait AsStoreRef

pub(crate) trait AsStoreRef {
    // Required method
    fn as_store_ref(&self) -> StoreRef<'_>;

    // Provided method
    fn as_store_async(&self) -> Option<impl AsStoreAsync + 'static> { ... }
}
Expand description

Helper trait for a value that is convertible to a [StoreRef].

Required Methods§

fn as_store_ref(&self) -> StoreRef<'_>

Returns a StoreRef pointing to the underlying context.

Provided Methods§

fn as_store_async(&self) -> Option<impl AsStoreAsync + 'static>

Returns a [StoreAsync] if the current context is asynchronous. The store will be locked since it’s already active in the current context, but can be used to spawn new coroutines via Function::call_async.

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§

§

impl AsStoreRef for Store

§

impl AsStoreRef for StoreAsyncReadLock

§

impl AsStoreRef for StoreAsyncWriteLock

§

impl AsStoreRef for StoreMut<'_>

§

impl AsStoreRef for StoreRef<'_>

§

impl<P> AsStoreRef for P
where P: Deref, <P as Deref>::Target: AsStoreRef,

§

impl<T> AsStoreRef for FunctionEnvMut<'_, T>

§

impl<T> AsStoreRef for AsyncFunctionEnvHandle<T>
where T: 'static,

§

impl<T> AsStoreRef for AsyncFunctionEnvHandleMut<T>
where T: 'static,