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 Freeze for ModuleTypes
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