This crate contains the public Mojo bindings for Rust.
In the Mojo source tree, this crate gets compiled directly with examples, so for instructions on how to use those examples, please see the //examples directory at the root of the repository.
Additionally, the Rust tests run as part of the overarching test suite, invoked by running
mojo/tools/mojob.py test
from the root directory.
mojo/tools/mojob.py gn mojo/tools/mojob.py build
First, set the Mojo output directory in order for Cargo to be able to find the Mojo dependencies:
export MOJO_OUT_DIR=/path/to/out/Debug
Then build normally using Cargo:
cargo build [--release]
Additional non-standard environment variables that Cargo will respond to:
Note: if you set MOJO_RUST_NO_EMBED, running tests will fail.
cargo test [--release]