We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 11d700d commit 9220b2eCopy full SHA for 9220b2e
1 file changed
src/interpreter.rs
@@ -29,6 +29,16 @@ impl InterpreterConfig {
29
self.init_hooks.push(hook);
30
self
31
}
32
+ pub fn add_native_module(
33
+ self,
34
+ name: impl ToOwned<Owned = String>,
35
+ make_module: fn(&VirtualMachine) -> rustpython_vm::PyObjectRef,
36
+ ) -> Self {
37
+ let name = name.to_owned();
38
+ self.init_hook(Box::new(move |vm| {
39
+ vm.add_native_module(name, Box::new(make_module))
40
+ }))
41
+ }
42
#[cfg(feature = "stdlib")]
43
pub fn init_stdlib(self) -> Self {
44
self.init_hook(Box::new(init_stdlib))
0 commit comments