Running Code Locally with Cargo
% rustc --version rustc 1.61.0 (fe5b13d68 2022-05-18) % cargo --version cargo 1.61.0 (a028ae4 2022-04-29)
With this is in place, then follow these steps to build a Rust binary from one of the examples in this training:
Click the “Copy to clipboard” button on the example you want to copy.
Navigate into and use
cargo run
to build and run your binary:$ cd exercise $ cargo run Compiling exercise v0.1.0 (/home/mgeisler/tmp/exercise) Finished dev [unoptimized + debuginfo] target(s) in 0.75s Running `target/debug/exercise` Hello, world!
Use
cargo run
to build and run your updated binary:
Try to encourage the class participants to install Cargo and use a local editor. It will make their life easier since they will have a normal development environment.