WasmModule

Struct WasmModule 

Source
pub struct WasmModule {
    pub inner: Arc<Module>,
    pub func_starts: HashMap<u32, usize>,
    pub func_names: Mutex<HashMap<u32, String>>,
    /* private fields */
}

Fields§

§inner: Arc<Module>§func_starts: HashMap<u32, usize>§func_names: Mutex<HashMap<u32, String>>

Implementations§

Source§

impl WasmModule

Source

pub fn new(inner: Arc<Module>) -> Self

Source

pub fn into_inner(self) -> Module

Source

pub fn add_func_name(&self, funcidx: u32, name: &str)

Source

pub fn add_global_name(&self, globalidx: u32, name: &str)

Source

pub fn get_coredump(&self) -> Result<Coredump, Box<dyn Error>>

Source

pub fn add_data(&self, offset: u32, bytes: &[u8]) -> (u32, u32)

Source

pub fn is_func_imported(&self, funcidx: u32) -> bool

Source

pub fn imports(&self) -> &Vec<Import>

Source

pub fn globals(&self) -> &Vec<Global>

Source

pub fn func_locals_count(&self, funcidx: u32) -> u32

Source

pub fn func_locals(&self, funcidx: u32) -> Vec<CodeLocal>

Source

pub fn is_func_exported(&self, funcidx: u32) -> bool

Source

pub fn get_export_func( &self, name: &str, ) -> Result<(&Code, Type), Box<dyn Error>>

Source

pub fn get_func_type(&self, funcidx: u32) -> Type

Retrieve the type of a function, note that this doesn’t work for imported functions as they have their type expressed differently.

Source

pub fn add_func_local(&self, target_funcidx: u32, local: CodeLocal) -> bool

Source

pub fn get_type(&self, typeidx: u32) -> Option<Type>

Source

pub fn get_func_typeidx(&self, funcidx: u32) -> u32

Source

pub fn get_start_of_func(&self, funcidx: u32) -> Option<usize>

Get the start binary offset of a function

Source

pub fn get_custom_section(&self, name: &str) -> Option<Vec<u8>>

Source

pub fn get_custom_sections(&self) -> &Vec<CustomSection>

Source

pub fn remove_custom_section(&self, name: &str) -> Option<()>

Source

pub fn get_func_name(&self, funcidx: u32) -> Option<String>

Source

pub fn find_import(&self, name: &str) -> u32

Source

pub fn add_global_import( &self, module: &str, name: &str, ty: &GlobalType, ) -> u32

Source

pub fn add_import(&self, _import: &Import) -> u32

Source

pub fn add_global(&self, global: &Global) -> Option<u32>

Source

pub fn add_export_func(&self, name: &str, funcidx: u32)

Source

pub fn add_function(&self, func: &Code, typeidx: u32) -> u32

Source

pub fn add_type(&self, t: &Type) -> u32

Source

pub fn add_section(&self, s: Section)

Source

pub fn add_custom_section(&self, s: CustomSection)

Source

pub fn get_build_id(&self) -> &Option<Vec<u8>>

Source

pub fn set_build_id(&self, build_id: &[u8])

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.