pub struct ModuleImports { /* private fields */ }Expand description
The set of imports in a module.
Implementations§
Source§impl ModuleImports
impl ModuleImports
Sourcepub fn get_mut(&mut self, id: ImportId) -> &mut Import
pub fn get_mut(&mut self, id: ImportId) -> &mut Import
Gets a reference to an import given its id
Sourcepub fn delete(&mut self, id: ImportId)
pub fn delete(&mut self, id: ImportId)
Removes an import from this module.
It is up to you to ensure that any potential references to the deleted
import are also removed, eg get_global expressions.
Sourcepub fn iter(&self) -> impl Iterator<Item = &Import>
pub fn iter(&self) -> impl Iterator<Item = &Import>
Get a shared reference to this module’s imports.
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Import>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Import>
Get mutable references to this module’s imports.
Sourcepub fn add(
&mut self,
module: &str,
name: &str,
kind: impl Into<ImportKind>,
) -> ImportId
pub fn add( &mut self, module: &str, name: &str, kind: impl Into<ImportKind>, ) -> ImportId
Adds a new import to this module
Sourcepub fn find(&self, module: &str, name: &str) -> Option<ImportId>
pub fn find(&self, module: &str, name: &str) -> Option<ImportId>
Get the import with the given module and name
Sourcepub fn get_func(
&self,
module: impl AsRef<str>,
name: impl AsRef<str>,
) -> Result<FunctionId>
pub fn get_func( &self, module: impl AsRef<str>, name: impl AsRef<str>, ) -> Result<FunctionId>
Retrieve an imported function by import name, including the module in which it resides
Sourcepub fn get_imported_func(&self, fid: FunctionId) -> Option<&Import>
pub fn get_imported_func(&self, fid: FunctionId) -> Option<&Import>
Retrieve an imported function by ID
Trait Implementations§
Source§impl Debug for ModuleImports
impl Debug for ModuleImports
Source§impl Default for ModuleImports
impl Default for ModuleImports
Source§fn default() -> ModuleImports
fn default() -> ModuleImports
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ModuleImports
impl RefUnwindSafe for ModuleImports
impl Send for ModuleImports
impl Sync for ModuleImports
impl Unpin for ModuleImports
impl UnwindSafe for ModuleImports
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