Cargo verwenden

Wenn du anfĂ€ngst ĂŒber Rust zu lesen, wirst du sehr bald Cargo, ein Standardwerkzeug, welches im Rust-Ökosystem verwendet wird, um Rust-Anwendungen zu erstellen und auszufĂŒhren, kennenlernen. Hier wollen wir einen kurzen Überblick geben, was Cargo ist und wie es in das breitere Ökosystem und in dieses Training passt.

Installation

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

This will give you the Cargo build tool (cargo) and the Rust compiler (rustc). You will also get rustup, a command line utility that you can use to install to different compiler versions.

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