| 204 | } |
| 205 | |
| 206 | pub fn with_module<M: ModuleDef, I: Into<ModuleInfo<M>>>(mut self, module: I) -> Self { |
| 207 | let module_info: ModuleInfo<M> = module.into(); |
| 208 | |
| 209 | self.module_resolver = self.module_resolver.add_name(module_info.name); |
| 210 | self.module_loader = self |
| 211 | .module_loader |
| 212 | .with_module(module_info.name, module_info.module); |
| 213 | self.global_attachment = self.global_attachment.add_name(module_info.name); |
| 214 | self |
| 215 | } |
| 216 | |
| 217 | pub fn with_global(mut self, init: fn(&Ctx<'_>) -> Result<()>) -> Self { |
| 218 | self.global_attachment = self.global_attachment.add_function(init); |