2020-10-12 23:07:35 +02:00
|
|
|
# cargo
|
|
|
|
|
|
|
|
> Verwalte Rust-Projekte und deren Abhängigkeiten (crates).
|
2021-09-13 10:21:21 +02:00
|
|
|
> Manche Unterbefehle wie `cargo build` sind separat dokumentiert.
|
2023-05-16 12:19:30 +02:00
|
|
|
> Weitere Informationen: <https://doc.rust-lang.org/cargo>.
|
2020-10-12 23:07:35 +02:00
|
|
|
|
|
|
|
- Suche nach Abhängigkeiten (crates):
|
|
|
|
|
2021-03-25 17:42:04 +01:00
|
|
|
`cargo search {{suche}}`
|
2020-10-12 23:07:35 +02:00
|
|
|
|
|
|
|
- Installiere eine Abhängigkeit (crate):
|
|
|
|
|
2021-03-25 17:42:04 +01:00
|
|
|
`cargo install {{abhängigkeit}}`
|
2020-10-12 23:07:35 +02:00
|
|
|
|
|
|
|
- Liste alle installierten Abhängigkeiten (crates) auf:
|
|
|
|
|
|
|
|
`cargo install --list`
|
|
|
|
|
2021-03-25 17:42:04 +01:00
|
|
|
- Erzeuge ein neues Rust-Projekt als Anwendung oder Bibliothek im aktuellen Verzeichnis:
|
2020-10-12 23:07:35 +02:00
|
|
|
|
|
|
|
`cargo init --{{bin|lib}}`
|
|
|
|
|
2021-03-25 17:42:04 +01:00
|
|
|
- Erzeuge ein neues Rust-Projekt als Anwendung oder Bibliothek im angegebenen Verzeichnis:
|
2020-10-12 23:07:35 +02:00
|
|
|
|
2021-03-25 17:42:04 +01:00
|
|
|
`cargo new {{pfad/zu/verzeichnis}} --{{bin|lib}}`
|
2020-10-12 23:07:35 +02:00
|
|
|
|
2021-03-25 17:42:04 +01:00
|
|
|
- Erstelle (bzw. kompiliere) ein Rust-Projekt im aktuellen Verzeichnis:
|
2020-10-12 23:07:35 +02:00
|
|
|
|
|
|
|
`cargo build`
|
|
|
|
|
2021-03-25 17:42:04 +01:00
|
|
|
- Erstelle (bzw. kompiliere) ein Rust-Projekt mit einer bestimmten Anzahl an Threads (standardmäßig die Anzahl der CPU-Kerne):
|
2020-10-12 23:07:35 +02:00
|
|
|
|
2021-09-11 09:53:04 +02:00
|
|
|
`cargo build --jobs {{thread_anzahl}}`
|