pub struct Processor<'a> { /* private fields */ }processor only.Expand description
WASM module processor encapsulating processing options.
Implementations§
Source§impl<'a> Processor<'a>
impl<'a> Processor<'a>
Sourcepub fn set_ref_table(&mut self, name: impl Into<Option<&'a str>>) -> &mut Self
pub fn set_ref_table(&mut self, name: impl Into<Option<&'a str>>) -> &mut Self
Sets the name of the exported externrefs table where refs obtained from the host
are placed. If set to None, the table will not be exported from the module.
By default, the table is exported as "externrefs".
Sourcepub fn set_drop_fn(&mut self, module: &'a str, name: &'a str) -> &mut Self
pub fn set_drop_fn(&mut self, module: &'a str, name: &'a str) -> &mut Self
Sets a function to notify the host about dropped externrefs. This function
will be added as an import with a signature (externref) -> () and will be called
immediately before dropping each reference.
By default, there is no notifier hook installed.
Sourcepub fn process(&self, module: &mut Module) -> Result<(), Error>
pub fn process(&self, module: &mut Module) -> Result<(), Error>
Processes the provided module.
§Errors
Returns an error if a module is malformed. This shouldn’t normally happen and
could be caused by another post-processor or a bug in the externref crate / proc macro.
Sourcepub fn process_bytes(&self, bytes: &[u8]) -> Result<Vec<u8>, Error>
pub fn process_bytes(&self, bytes: &[u8]) -> Result<Vec<u8>, Error>
Processes the provided WASM module bytes. This is a higher-level alternative to
Self::process().
§Errors
Returns an error if bytes does not represent a valid WASM module, and in all cases
Self::process() returns an error.