PR3-Rust-SS26/0-introduction/1-tooling.md

1.2 KiB

Rust installieren

  • Für Unix basierte Betriebssysteme:

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    
  • Für Windows: https://rustup.rs

Wichtige Cargo Befehle

Befehl Nutzen
cargo new <projectname> Neues Binary-Projekt erstellen
cargo build Debug Build
cargon run Builden und Runnen
cargo test Tests ausführen
cargo init Aktuellen Ordner als Cargo-Projekt initialisieren
cargo add Abhängigkeiten zu Cargo.toml hinzufügen
cargo remove Abhängigkeiten aus Cargo.toml entfernen
cargo tree Abhängigkeitsbaum hinzufügen
cargo fmt Code automatisch formattieren
cargo clippy Warnungen und Verbesserungsvorschläge