Das Rust-Ökosystem

Das Rust-Ökosystem besteht aus einer Reihe von Werkzeugen, von denen die wichtigsten die Folgenden sind:

  • rustc: the Rust compiler which turns .rs files into binaries and other intermediate formats.

  • cargo: the Rust dependency manager and build tool. Cargo knows how to download dependencies, usually hosted on https://crates.io, and it will pass them to rustc when building your project. Cargo also comes with a built-in test runner which is used to execute unit tests.

  • rustup: the Rust toolchain installer and updater. This tool is used to install and update rustc and cargo when new versions of Rust are released. In addition, rustup can also download documentation for the standard library. You can have multiple versions of Rust installed at once and rustup will let you switch between them as needed.

SchlĂŒsselpunkte:

  • Rust hat einen schnellen Veröffentlichungsplan. Alle sechs Wochen wird eine neue Version veröffentlicht. Neue Versionen bleiben rĂŒckwĂ€rtskompatibel mit Ă€lteren Versionen und fĂŒgen neue Funktionen hinzu.

  • Es gibt drei VeröffentlichungskanĂ€le: „stable“, „beta“ und „nightly“.

  • Neue Funktionen werden in „nightly“ getestet. „Beta“ wird alle sechs Wochen „stabil“.

  • Dependencies can also be resolved from alternative registries, git, folders, and more.

  • Rust hat auch [Editionen]: Die aktuelle Edition ist Rust 2021. Vorherige Editionen waren Rust 2015 und Rust 2018.

    • Editionen dĂŒrfen rĂŒckwĂ€rtsinkompatible Änderungen vornehmen.

    • Um zu verhindern, dass Code nicht kaputt geht, sind Editionen optional: Du wĂ€hlst ihre Edition fĂŒr deine Kiste (crate) in der Datei Cargo.toml

    • Um eine Aufspaltung des Ökosystems zu vermeiden, können Rust-Compiler Code der fĂŒr verschiedene Editionen geschrieben wurde vermischen.

    • ErwĂ€hne, dass es ziemlich selten vorkommt, dass der Compiler jemals direkt und nicht ĂŒber cargo verwendet wird (die meisten Benutzer tun dies nie).

    • It might be worth alluding that Cargo itself is an extremely powerful and comprehensive tool. It is capable of many advanced features including but not limited to:

      • Projekt-/Paketstruktur
      • [Arbeitsbereiche]
      • Verwaltung/Caching von EntwicklungsabhĂ€ngigkeiten und LaufzeitabhĂ€ngigkeiten
      • [Build-Skripting]
      • [globale Installation]
      • Es ist auch mit Unterbefehls-Plugins erweiterbar (z. B. cargo clippy).
    • Lese mehr aus dem [offiziellen Cargo Buch]