pub trait WasmExternRef<E: WasmEngine>:
Clone
+ Sized
+ Send
+ Sync {
// Required methods
fn new<T: 'static + Send + Sync>(
ctx: impl AsContextMut<E>,
object: T,
) -> Self;
fn downcast<'a, 's: 'a, T: 'static, S: 'static>(
&'a self,
store: E::StoreContext<'s, S>,
) -> Result<&'a T>;
}Expand description
Provides an opaque reference to any data within WebAssembly.
Required Methods§
Sourcefn new<T: 'static + Send + Sync>(ctx: impl AsContextMut<E>, object: T) -> Self
fn new<T: 'static + Send + Sync>(ctx: impl AsContextMut<E>, object: T) -> Self
Creates a new reference wrapping the given value.
Sourcefn downcast<'a, 's: 'a, T: 'static, S: 'static>(
&'a self,
store: E::StoreContext<'s, S>,
) -> Result<&'a T>
fn downcast<'a, 's: 'a, T: 'static, S: 'static>( &'a self, store: E::StoreContext<'s, S>, ) -> Result<&'a T>
Returns a shared reference to the underlying data.
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.