pub struct WasmPlugin { /* private fields */ }
Expand description
An instantiated plugin with cached exports.
Implementations§
Source§impl WasmPlugin
impl WasmPlugin
Sourcepub fn builder<E: Any + Send + Sized + 'static>() -> WasmPluginBuilder<E>
pub fn builder<E: Any + Send + Sized + 'static>() -> WasmPluginBuilder<E>
Creates a builder to create a new WasmPlugin.
Sourcepub fn function<H: GuestFunctionHandle + 'static>(&self) -> Option<&H::Callback>
pub fn function<H: GuestFunctionHandle + 'static>(&self) -> Option<&H::Callback>
Looks up cached guest export by function handle.
Sourcepub fn function_or_cache<H: GuestFunctionHandle + 'static>(
&mut self,
) -> Option<&H::Callback>
pub fn function_or_cache<H: GuestFunctionHandle + 'static>( &mut self, ) -> Option<&H::Callback>
Looks up cached guest export by function handle. If no matches are found tries to resolve export from wasm instance and cache the result.
Sourcepub fn function_unwrap<H: GuestFunctionHandle + 'static>(&self) -> &H::Callback
pub fn function_unwrap<H: GuestFunctionHandle + 'static>(&self) -> &H::Callback
Looks up cached guest export by function handle.
§Panics
If function was not cached with make_exports!
.
Sourcepub fn function_unwrap_or_cache<'this: 'cb, 'cb, H: GuestFunctionHandle + 'static>(
&'this mut self,
) -> &'cb H::Callback
pub fn function_unwrap_or_cache<'this: 'cb, 'cb, H: GuestFunctionHandle + 'static>( &'this mut self, ) -> &'cb H::Callback
Looks up cached guest export by function handle. If no matches are found tries to resolve export from wasm instance and cache the result.
§Panics
If failed to find function in exports and it is missing in wasm instance.
Sourcepub fn serialize(&self) -> Result<Vec<u8>, SerializeError>
pub fn serialize(&self) -> Result<Vec<u8>, SerializeError>
Serializes plugin into bytes to use with headless mode.
Sourcepub fn serialize_to_file(
&self,
path: impl AsRef<Path>,
) -> Result<(), SerializeError>
pub fn serialize_to_file( &self, path: impl AsRef<Path>, ) -> Result<(), SerializeError>
Serializes plugin into bytes to use with headless mode and writes them to file.
Sourcepub fn serialize_compress(&self) -> Result<Vec<u8>, SerializeError>
Available on crate feature flate2
only.
pub fn serialize_compress(&self) -> Result<Vec<u8>, SerializeError>
flate2
only.Serializes plugin and compresses bytes to use with headless mode.
Sourcepub fn serialize_to_file_compress(
&self,
path: impl AsRef<Path>,
) -> Result<(), SerializeError>
Available on crate feature flate2
only.
pub fn serialize_to_file_compress( &self, path: impl AsRef<Path>, ) -> Result<(), SerializeError>
flate2
only.Serializes plugin to file and compresses bytes to use with headless mode.
Auto Trait Implementations§
impl Freeze for WasmPlugin
impl !RefUnwindSafe for WasmPlugin
impl !Send for WasmPlugin
impl !Sync for WasmPlugin
impl Unpin for WasmPlugin
impl !UnwindSafe for WasmPlugin
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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>
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>
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 more