Trait ModuleTextResolver

Source
pub trait ModuleTextResolver {
    // Required method
    fn resolve(&self, id: Id) -> Option<&ModuleText<'_>>;
}
Expand description

An interface that provides access to script module texts by module Id.

When displaying runtime errors (through the RuntimeError::display function), the inner algorithm needs access to the script module text of the modules mentioned in the error’s description. You can implement this trait on your custom multi-module compiler to provide access to the module texts.

If your compiler consists of runtime-independent script modules, you can use a normal ModuleText, which implements ModuleTextResolver out of the box.

Required Methods§

Source

fn resolve(&self, id: Id) -> Option<&ModuleText<'_>>

If the underlying compiler contains a script module with id, returns ModuleText of this module. Otherwise, returns None.

Implementors§