Utilizzo di Cargo

Quando inizi a leggere su Rust, incontrerai presto Cargo, lo strumento standard utilizzato nell’ecosistema Rust per creare ed eseguire applicazioni Rust. Qui vogliamo fornire una breve panoramica di cos’è Cargo e di come si inserisce nell’ecosistema e in questa formazione.

Installazione

Please follow the instructions on https://rustup.rs/.

Questo fornisce il “build tool” Cargo (cargo) e il compilatore Rust (rustc). Inoltre anche rustup, una utility da “command line” che può essere utilizzata per installare diverse versioni del compilatore.

After installing Rust, you should configure your editor or IDE to work with Rust. Most editors do this by talking to rust-analyzer, which provides auto-completion and jump-to-definition functionality for VS Code, Emacs, Vim/Neovim, and many others. There is also a different IDE available called RustRover.

  • On Debian/Ubuntu, you can also install Cargo, the Rust source and the Rust formatter via apt. However, this gets you an outdated rust version and may lead to unexpected behavior. The command would be:

    sudo apt install cargo rust-src rustfmt