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

Function main

example_projects/barebone/src/main.rs:3–17  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1use rustpython_vm::Interpreter;
2
3pub fn main() {
4 let interp = Interpreter::without_stdlib(Default::default());
5 let value = interp.enter(|vm| {
6 let max = vm.builtins.get_attr("max", vm)?;
7 let value = max.call((vm.ctx.new_int(5), vm.ctx.new_int(10)), vm)?;
8 vm.print((vm.ctx.new_str("python print"), value.clone()))?;
9 Ok(value)
10 });
11 match value {
12 Ok(value) => println!("Rust repr: {:?}", value),
13 Err(err) => {
14 interp.finalize(err);
15 }
16 }
17}

Callers

nothing calls this directly

Calls 8

enterMethod · 0.45
get_attrMethod · 0.45
callMethod · 0.45
new_intMethod · 0.45
printMethod · 0.45
new_strMethod · 0.45
cloneMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected