pub struct Function<'a> {
pub kind: FunctionKind<'a>,
pub name: &'a str,
pub externrefs: BitSlice<'a>,
}Expand description
Information about a function with Resource args or return type.
This information is written to a custom section of a WASM module and is then used during module post-processing.
Fields
kind: FunctionKind<'a>Kind of this function.
name: &'a strName of this function.
externrefs: BitSlice<'a>Bit slice marking Resource args / return type.
Implementations
sourceimpl<'a> Function<'a>
impl<'a> Function<'a>
sourcepub const CUSTOM_SECTION_NAME: &'static str = "__externrefs"
pub const CUSTOM_SECTION_NAME: &'static str = "__externrefs"
Name of a custom section in WASM modules where Function declarations are stored.
Functions can be read from this section using Self::read_from_section().
sourcepub fn read_from_section(buffer: &mut &'a [u8]) -> Result<Self, ReadError>
pub fn read_from_section(buffer: &mut &'a [u8]) -> Result<Self, ReadError>
Reads function information from a WASM custom section. After reading, the buffer
is advanced to trim the bytes consumed by the parser.
This crate does not provide tools to read custom sections from a WASM module;
use a library like walrus or wasmparser for this purpose.
Errors
Returns an error if the custom section is malformed.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Function<'a>
impl<'a> Send for Function<'a>
impl<'a> Sync for Function<'a>
impl<'a> Unpin for Function<'a>
impl<'a> UnwindSafe for Function<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more