occlum/demos/rust
2023-09-25 17:06:13 +08:00
..
rust_app [demos] Add a multithread mmap rust demo 2023-09-25 17:06:13 +08:00
.gitignore [demos] Add a multithread mmap rust demo 2023-09-25 17:06:13 +08:00
README.md [demos] Add a multithread mmap rust demo 2023-09-25 17:06:13 +08:00
run_rust_demo_on_occlum.sh Modify rust demo with copy_bom 2021-09-17 15:50:15 +08:00
rust-demo.yaml Modify rust demo with copy_bom 2021-09-17 15:50:15 +08:00

Use Rust with Occlum

This directory contains scripts and source code to demonstrate how to compile and run Rust programs on Occlum.

occlum-cargo and occlum-rustc

We introduce cargo and rustc wrappers called occlum-cargo and occlum-rustc respectively. They wrap the original commands with options specific to occlum. Refer to tools/toolchains/rust/build.sh for more information.

rust_app

This directory contains source code of a Rust program with two test cases. One is a cpp FFI test, where the cpp interface increments the input by one. The other is a multithreading file backed mmap test. Rust code calls the function and displays the result on the terminal.

One can use occlum-cargo in the way cargo is used. In the rust_app directory, calling occlum-cargo build will build the demo and occlum-cargo run will run the demo on host. To run the demo in occlum, run:

run_rust_demo_on_occlum.sh

The output will be displayed on the terminal:

Cpp FFI test passed!
Multithreading mmap test passed!