[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/RustPython/RustPython/master/examples/hello_embed.rs [Back]  [Original]

use rustpython_vm as vm;

fn main() -> vm::PyResult {
    vm::Interpreter::without_stdlib(Default::default()).enter(|vm| {
        let scope = vm.new_scope_with_builtins();
        let source = r#"print("Hello World!")"#;
        let code_obj = vm
            .compile(source, vm::compiler::Mode::Exec, "")
            .map_err(|err| err.into_pyexception(vm, Some(source)))?;

        vm.run_code_obj(code_obj, scope)?;

        Ok(())
    })
}

Web Proxy Viewer  |  New URL  |  Original Page