FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
RustPython/examples/hello_embed.rs at main · RustPython/RustPython · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
RustPython
/
RustPython
Public
Notifications
You must be signed in to change notification settings
Fork
1.5k
Star
22.3k
Code
Issues
295
Pull requests
104
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
RustPython
/
examples
/
hello_embed.rs
Copy path
More file actions
More file actions
Latest commit
History
History
History
15 lines (12 loc) · 459 Bytes
Breadcrumbs
RustPython
/
examples
/
hello_embed.rs
Copy path
File metadata and controls
15 lines (12 loc) · 459 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
,
"<embedded>"
)
.
map_err
(
|err| err
.
into_pyexception
(
vm
,
Some
(
source
)
)
)
?
;
vm
.
run_code_obj
(
code_obj
,
scope
)
?
;
Ok
(
(
)
)
}
)
}
Back
|
FazBrowse Home
|
New Git URL