MCPcopy Index your code
hub / github.com/RustPython/RustPython / main

Function main

examples/hello_embed.rs:3–15  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1use rustpython_vm as vm;
2
3fn main() -> vm::PyResult<()> {
4 vm::Interpreter::without_stdlib(Default::default()).enter(|vm| {
5 let scope = vm.new_scope_with_builtins();
6 let source = r#"print("Hello World!")"#;
7 let code_obj = vm
8 .compile(source, vm::compiler::Mode::Exec, "<embedded>".to_owned())
9 .map_err(|err| vm.new_syntax_error(&err, Some(source)))?;
10
11 vm.run_code_obj(code_obj, scope)?;
12
13 Ok(())
14 })
15}

Callers

nothing calls this directly

Calls 7

new_syntax_errorMethod · 0.80
run_code_objMethod · 0.80
SomeClass · 0.50
enterMethod · 0.45
compileMethod · 0.45
to_ownedMethod · 0.45

Tested by

no test coverage detected