Struct walrus::ModuleTypes
source · pub struct ModuleTypes { /* private fields */ }
Expand description
The set of de-duplicated types within a module.
Implementations§
source§impl ModuleTypes
impl ModuleTypes
sourcepub fn params_results(&self, id: TypeId) -> (&[ValType], &[ValType])
pub fn params_results(&self, id: TypeId) -> (&[ValType], &[ValType])
Get the parameters and results for the given type.
sourcepub fn by_name(&self, name: &str) -> Option<TypeId>
pub fn by_name(&self, name: &str) -> Option<TypeId>
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.
sourcepub fn iter(&self) -> impl Iterator<Item = &Type>
pub fn iter(&self) -> impl Iterator<Item = &Type>
Get a shared reference to this module’s types.
sourcepub fn delete(&mut self, ty: TypeId)
pub fn delete(&mut self, ty: TypeId)
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.
Trait Implementations§
source§impl Debug for ModuleTypes
impl Debug for ModuleTypes
source§impl Default for ModuleTypes
impl Default for ModuleTypes
source§fn default() -> ModuleTypes
fn default() -> ModuleTypes
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl RefUnwindSafe for ModuleTypes
impl Send for ModuleTypes
impl Sync for ModuleTypes
impl Unpin for ModuleTypes
impl UnwindSafe for ModuleTypes
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more