Struct rquickjs_core::module::ModulesBuilder
source · pub struct ModulesBuilder { /* private fields */ }
Expand description
A struct for loading multiple modules at once safely.
Modules are built in two steps, declare and evaluate. During evaluation a module might import another module, if no such declared module exist the evaluation fails.
This struct allows one to first declare all possible modules and then evaluate them allowing modules to import each other.
Only use if you need to acquire the module objects after. Otherwise, it is easier to use the
other safe methods on the Module
struct like Module::evaluate
Implementations§
source§impl ModulesBuilder
impl ModulesBuilder
pub fn new() -> Self
pub fn source<N, S>(self, name: N, source: S) -> Self
pub fn with_source<N, S>(&mut self, name: N, source: S) -> &mut Self
pub fn native<D, N>(self, name: N) -> Self
pub fn with_native<D, N>(&mut self, name: N) -> &mut Self
pub fn eval<'js>(self, ctx: &Ctx<'js>) -> Result<Vec<Module<'js>>>
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for ModulesBuilder
impl Send for ModulesBuilder
impl Sync for ModulesBuilder
impl Unpin for ModulesBuilder
impl UnwindSafe for ModulesBuilder
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