Rustup management tool

Rustup is a command-line application that can be downloaded and switched between different versions of the Rust toolchain-such as the compiler rustc and the standard library. The application supports a large number of platforms. In fact, rustc itself supports about 56 platforms, and rustup can actually manage compilers for 14 platforms and standard libraries for 30 platforms.

Generally, the installation will not only install the rust compiler, but download the rustup tool, which is the rust installer (installs the compiler, standard library, Cargo, etc.) and the rust version management tool (switchable rust version)

Install rustup : curl https://sh.rustup.rs -sSf | sh

rustup feature set (official statement):
    Manage and install multiple official versions of Rust binaries.
    Configure a catalog-based Rust toolchain.
    Install and update from Rust's release channels: nightly, beta and stable.
    Receive notifications from the release channel update.
    Install the historical version of the nightly toolchain from the official.
    Install by specifying the stable version.
    Install additional std for cross-compilation.
    Install a customized toolchain.
    Independent of each installed Cargo metadata.
    Verify the downloaded hash value.
    Verify the signature (if GPG exists).
    http.
    Only rely on bash, curl and common unix tools.
    Support Linux, OS X, Windows (via MSYS2).
    
Personal understanding of the purpose of rust : The tool for managing the compiler can be updated to manage the rustc rustdoc and other toolchain
    
versions:
    stable version-the stable version of Rust, released every 6 weeks.
    The beta version-the public beta version of Rust, will be the next stable version.
    nightly version-updated every day, including some experimental new features.
    
Components installed by default in rustup:
    rustc — Rust compiler.
    rust-std — Rust standard library.
    cargo — package management and build tool, similar to Java's Maven and Gradle.
    rust-docs — Rust documentation.
    rustfmt — Used to format Rust source code.
    clippy — Rust's code inspection tool.
    (Note: The wasm tool is not included. To install wasm, use the command rustup target add wasm32-unknown-unknown --toolchain nightly-2021-03-03) Command usage:
---------------- -------------------------------------------------- -------------

展示目前所有安装的工具链:
rustup show

设置当前默认工具链版本:
rustup default nightly
rustup default nightly-2021-03-03-x86_64-unknown-linux-gnu

安装工具链:
rustup install nightly
rustup install nightly-2021-03-03

更新所有工具链:
rustup update
rustup self update (更新自己)

指定工具链版本进行某些命令的操作:
rustup run nightly-2021-03-03-x86_64-unknown-linux-gnu rustc --version

Actual combat drill:

It is worth noting that we have installed a lot of toolchain toolchain versions, and currently there are default ones. We still specify which toolchain version to use for the current project, and create a file named rust-toolchain in the root directory of the project. The content is as follows :

nightly-2020-09-30

Use this to specify the toolchain version.

 

 

 

 

 

 


 

Guess you like

Origin blog.csdn.net/liujiayu2/article/details/114363649