[][src]Struct walrus::ModuleTypes

pub struct ModuleTypes { /* fields omitted */ }

The set of de-duplicated types within a module.

Methods

impl ModuleTypes[src]

pub fn get(&self, id: TypeId) -> &Type[src]

Get a type associated with an ID

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

Get a type associated with an ID

pub fn params_results(&self, id: TypeId) -> (&[ValType], &[ValType])[src]

Get the parameters and results for the given type.

pub fn params(&self, id: TypeId) -> &[ValType][src]

Get the parameters for the given type.

pub fn results(&self, id: TypeId) -> &[ValType][src]

Get the results for the given type.

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

Get a type ID by its name.

This is currently only intended for in-memory modifications, and by default will always return None for a newly parsed module. A hypothetical future WAT text format to walrus::Module parser could preserve type names from the WAT.

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

Get a shared reference to this module's types.

pub fn delete(&mut self, ty: TypeId)[src]

Removes a type from this module.

It is up to you to ensure that any potential references to the deleted type are also removed, eg call_indirect expressions, function types, etc.

pub fn add(&mut self, params: &[ValType], results: &[ValType]) -> TypeId[src]

Add a new type to this module, and return its Id

pub fn find(&self, params: &[ValType], results: &[ValType]) -> Option<TypeId>[src]

Find the existing type for the given parameters and results.

Trait Implementations

impl Default for ModuleTypes[src]

impl Debug for ModuleTypes[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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