I recently learned that setting up Rust execution in Quarto is easy via evcxr_jupyter.
The first thing you need to do is ensure that Rust is installed. See Install Rust.
It doesn’t hurt to run rustup update if you have not updated in a while.
Then you can use Cargo to install the relevant crate. Expect this step to take a while.
$ cargo install evcxr_jupyterThen, if necessary, add the executable evcxr_jupyter to PATH. On Debian-based Linux put the following in your .bashrc file
export PATH=$PATH:~/.cargo/bin/and run source .bashrc.
Then use the binary to install the Jupyter tool.
evcxr_jupyter --installAt this point it should be installed. You’ll see a Rust kernel will be available when you use jupyter notebook and Quarto will similarly recognize Rust code in {rust} as being executable. Start with something like a “Hello, World” example. You’ll find that in the Rust REPL you will not need to specify main {...}.
fn main() {
println!("Hello, World.");
}Hello, World.You can control the code echo by using //| echo: true and //| echo: false near the beginning of the code block.