Rust 通常被称为 rust-lang。Rust 是一个由 Mozilla Research 赞助的通用的、多范式、现代的、跨平台和开源系统编程语言。
它旨在实现安全性、速度和并发性等目标。
Rust 在语法上与 C++ 相似,但它的设计者希望它在保持性能的同时提供更好的内存安全性。
Rust 目前在许多组织中使用,例如 Firefox、Chef、Dropbox、Oracle、GNOME 等。
如何在 Linux 中安装 Rust 语言?
我们可以通过多种方式安装 Rust,但以下是官方推荐的安装方式。
$ curl https://sh.rustup.rs -sSf | sh info: downloading installer -
Welcome to Rust! -
This will download and install the official compiler for the Rust programming language, and its package manager, Cargo. -
It will add the cargo, rustc, rustup and other commands to Cargo's bin directory, located at: -
/home/daygeek/.cargo/bin -
This path will then be added to your PATH environment variable by modifying the profile files located at: -
/home/daygeek/.profile /home/daygeek/.bash_profile -
You can uninstall at any time with rustup self uninstall and these changes will be reverted. -
Current installation options: -
default host triple: x86_64-unknown-linux-gnu default toolchain: stable modify PATH variable: yes -
1) Proceed with installation (default) 2) Customize installation 3) Cancel installation >1 -
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2018-12-06, rust version 1.31.0 (abe02cefd 2018-12-04) info: downloading component 'rustc' 77.7 MiB / 77.7 MiB (100 %) 1.2 MiB/s ETA: 0 s info: downloading component 'rust-std' 54.2 MiB / 54.2 MiB (100 %) 1.2 MiB/s ETA: 0 s info: downloading component 'cargo' 4.7 MiB / 4.7 MiB (100 %) 1.2 MiB/s ETA: 0 s info: downloading component 'rust-docs' 8.5 MiB / 8.5 MiB (100 %) 1.2 MiB/s ETA: 0 s info: installing component 'rustc' info: installing component 'rust-std' info: installing component 'cargo' info: installing component 'rust-docs' info: default toolchain set to 'stable' -
stable installed - rustc 1.31.0 (abe02cefd 2018-12-04) -
-
Rust is installed now. Great! -
To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH environment variable. Next time you log in this will be done automatically. -
To configure your current shell run source $HOME/.cargo/env
运行以下命令配置当前 shell。
$ source $HOME/.cargo/env
运行以下命令验证已安装的 Rust 版本。
$ rustc --version rustc 1.31.0 (abe02cefd 2018-12-04)
如何测试 Rust 编程语言?
安装 Rust 后,请按照以下步骤检查 Rust 语言是否正常工作。
$ mkdir ~/projects $ cd ~/projects $ mkdir hello_world $ cd hello_world
(编辑:ASP站长网)
|