Ekosystem Rusta
Ekosystem Rusta składa się z wielu narzędzi, z których główne to:
-
rustc: kompilator Rusta, który zmienia pliki.rsna pliki binarne i inne formaty pośrednie. -
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 torustcwhen 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 updaterustcandcargowhen new versions of Rust are released. In addition,rustupcan also download documentation for the standard library. You can have multiple versions of Rust installed at once andrustupwill let you switch between them as needed.
Kluczowe punkty:
-
Rust ma szybki harmonogram wydań z nową wersją co sześć tygodni. Nowe wersje zachowują kompatybilność wsteczną z starymi wersjami — plus umożliwiają nowe funkcjonalności.
-
Istnieją trzy kanały wydania: “stable” (“stabilny”), “beta” i “nightly” (“nocny”).
-
Nowe funkcje są testowane na “nightly”, “beta” jest tym, co staje się “stable” co sześć tygodni.
-
Dependencies can also be resolved from alternative registries, git, folders, and more.
-
Rust ma również edycje: obecna edycja to Rust 2021. Poprzednie edycje to Rust 2015 i Rust 2018.
-
Edycje mogą wprowadzać do języka zmiany niekompatybilne wstecznie.
-
Aby zapobiec niekompatybilności kodu, edycje są opcjonalne: wybierasz edycję swojej skrzyni za pomocą pliku
Cargo.toml. -
Aby uniknąć podziału ekosystemu, kompilatory Rusta mogą mieszać kod napisany dla różnych edycji.
-
Wspomnij, że dość rzadko używa się kompilatora bezpośrednio, a nie przez
cargo(większość użytkowników nigdy tego nie robi). -
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:
- Struktura projektu/pakietu
- obszary robocze
- Zarządzanie/buforowanie zależności
- tworzenie skryptów
- instalacja globalna
- Jest również rozszerzalne za pomocą wtyczek poleceń podrzędnych (takich jak cargo clippy).
-
Przeczytaj więcej w oficjalnej księdze Cargo
-