Original text fromhttps://solleter.me
About the introduction of rust, there is no more description here. There is a lot of information on the network. Here, let’s start directly. This series of blogs is learningRust programming language simplified Chinese versionSome notes in the process. There are many places, but also refer to the official English version.
There is no standard answer to whether I should learn rust. For me, I mainly want to accumulate some experience in compiled system level language, because I only know C + + and can probably understand it, which is far from reaching the level of proficient code, but I don’t want to learn C + +, so I chose rust.
Before installation, there are a few things to understand
-
Rustup
It is used to install, update and manage different platform versions of rust -
Rust
Version hasStable
,Nightly
, some new features are usually in nightly version. After stabilization, they may be added to stable officially. Generally, we can use stable version -
toolchain
Here, we simply understand it as a rust version - On windows, you will find that even the stable version will have
gnu
andmsvc
Either version can be used at present. MSVC is used on windows by default. Just keep the default here -
cargo
Used to organize rust projects, such as creating projects, building projects, testing projects, etc.
Download and install rustup
visithttps://www.rust-lang.org/zh-CN/tools/install
, if it is under Windows system, download itRUSTUP-INIT.EXE
, if it is OSX or Linux, use its script to downloadcurl https://sh.rustup.rs -sSf | sh
Install rust
Download goodrustup
After running, it should run automatically under OSX or Linux. After running, the following interface will appear
Just keep the default here. Enter1
Then press enter to install. You can see here that the default installation isstable msvc
Versionrust
。 Here will be automatically downloaded, installed and then set.
Here, when you see this interface, it means that it has been downloaded and installed and can be used.
View and modify configuration
-
rustc --version
View rustc version -
cargo --version
View cargo version -
rustup toolchain list
Lists the currently installed version of trust, (default) is the currently used version -
rustup default stable-x86_64-pc-windows-msvc
Set the version of trust using stable MSVC (which can be abbreviated as stable MSVC) -
rustup default stable-x86_64-pc-windows-gnu
Set the version of trust using stable GNU (which can be abbreviated as stable GNU)