[][src]Struct walrus::ModuleFunctions

pub struct ModuleFunctions { /* fields omitted */ }

The set of functions within a module.

Implementations

impl ModuleFunctions[src]

pub fn new() -> ModuleFunctions[src]

Construct a new, empty set of functions for a module.

pub fn add_import(&mut self, ty: TypeId, import: ImportId) -> FunctionId[src]

Create a new externally defined, imported function.

pub fn add_local(&mut self, func: LocalFunction) -> FunctionId[src]

Create a new internally defined function

pub fn get(&self, id: FunctionId) -> &Function[src]

Gets a reference to a function given its id

pub fn get_mut(&mut self, id: FunctionId) -> &mut Function[src]

Gets a reference to a function given its id

pub fn by_name(&self, name: &str) -> Option<FunctionId>[src]

Get a function ID by its name.

The name used is the "name" custom section name and not the export name, if a function happens to be exported.

Note that function names are not guaranteed to be unique. This will return the first function in the module with the given name.

pub fn delete(&mut self, id: FunctionId)[src]

Removes a function from this module.

It is up to you to ensure that any potential references to the deleted function are also removed, eg call expressions, exports, table elements, etc.

pub fn iter(&self) -> impl Iterator<Item = &Function>[src]

Get a shared reference to this module's functions.

pub fn iter_local(&self) -> impl Iterator<Item = (FunctionId, &LocalFunction)>[src]

Get an iterator of this module's local functions

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Function>[src]

Get a mutable reference to this module's functions.

pub fn iter_local_mut(
    &mut self
) -> impl Iterator<Item = (FunctionId, &mut LocalFunction)>
[src]

Get an iterator of this module's local functions

Trait Implementations

impl Debug for ModuleFunctions[src]

impl Default for ModuleFunctions[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.