成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

如何在Linux中安裝Rust編程語言

系統 Linux
Rust 通常被稱為 rust-lang。Rust 是一個由 Mozilla Research 贊助的通用的、多范式、現代的、跨平臺和開源系統編程語言。

[[253802]]

Rust 通常被稱為 rust-lang。Rust 是一個由 Mozilla Research 贊助的通用的、多范式、現代的、跨平臺和開源系統編程語言。

它旨在實現安全性、速度和并發性等目標。

Rust 在語法上與 C++ 相似,但它的設計者希望它在保持性能的同時提供更好的內存安全性。

Rust 目前在許多組織中使用,例如 Firefox、Chef、Dropbox、Oracle、GNOME 等。

如何在 Linux 中安裝 Rust 語言?

我們可以通過多種方式安裝 Rust,但以下是官方推薦的安裝方式。

  1. $ curl https://sh.rustup.rs -sSf | sh
  2. info: downloading installer
  3.  
  4. Welcome to Rust!
  5.  
  6. This will download and install the official compiler for the Rust programming
  7. language, and its package manager, Cargo.
  8.  
  9. It will add the cargo, rustc, rustup and other commands to Cargo's bin
  10. directory, located at:
  11.  
  12. /home/daygeek/.cargo/bin
  13.  
  14. This path will then be added to your PATH environment variable by modifying the
  15. profile files located at:
  16.  
  17. /home/daygeek/.profile
  18. /home/daygeek/.bash_profile
  19.  
  20. You can uninstall at any time with rustup self uninstall and these changes will
  21. be reverted.
  22.  
  23. Current installation options:
  24.  
  25. default host triple: x86_64-unknown-linux-gnu
  26. default toolchain: stable
  27. modify PATH variable: yes
  28.  
  29. 1) Proceed with installation (default)
  30. 2) Customize installation
  31. 3) Cancel installation
  32. >1
  33.  
  34. info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
  35. info: latest update on 2018-12-06, rust version 1.31.0 (abe02cefd 2018-12-04)
  36. info: downloading component 'rustc'
  37. 77.7 MiB / 77.7 MiB (100 %) 1.2 MiB/s ETA: 0 s
  38. info: downloading component 'rust-std'
  39. 54.2 MiB / 54.2 MiB (100 %) 1.2 MiB/s ETA: 0 s
  40. info: downloading component 'cargo'
  41. 4.7 MiB / 4.7 MiB (100 %) 1.2 MiB/s ETA: 0 s
  42. info: downloading component 'rust-docs'
  43. 8.5 MiB / 8.5 MiB (100 %) 1.2 MiB/s ETA: 0 s
  44. info: installing component 'rustc'
  45. info: installing component 'rust-std'
  46. info: installing component 'cargo'
  47. info: installing component 'rust-docs'
  48. info: default toolchain set to 'stable'
  49.  
  50. stable installed - rustc 1.31.0 (abe02cefd 2018-12-04)
  51.  
  52.  
  53. Rust is installed now. Great!
  54.  
  55. To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH
  56. environment variable. Next time you log in this will be done automatically.
  57.  
  58. To configure your current shell run source $HOME/.cargo/env

運行以下命令配置當前 shell。

  1. $ source $HOME/.cargo/env

運行以下命令驗證已安裝的 Rust 版本。

  1. $ rustc --version
  2. rustc 1.31.0 (abe02cefd 2018-12-04)

如何測試 Rust 編程語言?

安裝 Rust 后,請按照以下步驟檢查 Rust 語言是否正常工作。

  1. $ mkdir ~/projects
  2. $ cd ~/projects
  3. $ mkdir hello_world
  4. $ cd hello_world

創建一個文件并添加以下代碼并保存。確保 Rust 文件始終以 .rs 擴展名結尾。

  1. $ vi 2g.rs
  2.  
  3. fn main() {
  4. println!("Hello, It's 2DayGeek.com - Best Linux Practical Blog!");
  5. }

運行以下命令編譯 rust 代碼。

  1. $ rustc 2g.rs

上面的命令將在同一目錄中創建一個可執行的 Rust 程序。

  1. $ ls -lh
  2. total 3.9M
  3. -rwxr-xr-x 1 daygeek daygeek 3.9M Dec 14 11:09 2g
  4. -rw-r--r-- 1 daygeek daygeek 86 Dec 14 11:09 2g.rs

運行 Rust 可執行文件得到輸出。

  1. $ ./2g
  2. Hello, It's 2DayGeek.com - Best Linux Practical Blog!

好了!正常工作了。

將 Rust 更新到***版本。

  1. $ rustup update
  2. info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
  3. info: checking for self-updates
  4.  
  5. stable-x86_64-unknown-linux-gnu unchanged - rustc 1.31.0 (abe02cefd 2018-12-04)

運行以下命令從系統中刪除 Rust 包。

  1. $ rustup self uninstall

卸載 Rust 包后,刪除 Rust 項目目錄。

  1. $ rm -fr ~/projects
責任編輯:龐桂玉 來源: Linux中國
相關推薦

2018-05-30 08:01:17

LinuxNcurses編程庫

2023-07-28 09:59:31

2015-09-01 11:40:21

LinuxVisual Stud

2022-11-30 12:17:50

2023-02-14 13:32:55

2021-09-21 15:31:05

Kali LinuxVMware安裝

2011-01-06 13:22:00

2021-03-23 14:50:16

編程語言Rust漏洞

2018-08-27 14:50:46

LinuxShellBash

2023-01-15 17:11:44

Rust

2021-11-01 12:45:29

UbuntuLinuxRust

2024-09-06 11:34:15

RustAI語言

2009-07-28 08:39:56

Linux應用軟件Linux應用

2022-07-26 17:25:38

Linux

2023-02-21 11:30:38

2023-03-14 16:44:20

Linuxhtop

2020-06-10 15:21:09

FedoraLinuxNvidia驅動

2024-02-27 08:39:19

RustJSON字符串

2011-03-09 15:54:34

LAMP

2020-04-21 14:21:31

LinuxPython
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 国产成人综合在线 | 波多野结衣一二三区 | 综合久久久久久久 | 中文字幕在线中文 | 国产片淫级awww | 成人a视频在线观看 | 日本精品久久久一区二区三区 | 四虎在线观看 | 久久综合一区 | 奇米四色在线观看 | 天天干天天操 | 日韩最新网址 | 91精品国产91久久综合桃花 | 伊人影院在线观看 | 国产一区二区日韩 | 久久精品99国产精品日本 | 亚洲成人黄色 | 久久精品免费一区二区三 | 热99| 丁香久久 | 欧美精品三区 | 欧美狠狠操 | 国产高清在线 | 国产精品视频免费 | 狠狠躁天天躁夜夜躁婷婷老牛影视 | 国产精品视频500部 a久久 | 日本一区视频在线观看 | 黄色一级大片在线免费看产 | xnxx 日本免费 | 久干网 | 日韩在线国产 | 久久777| 日韩一 | 欧美日韩在线综合 | 国产成人网 | www亚洲精品 | 仙人掌旅馆在线观看 | 91成人在线视频 | 99在线观看视频 | 日韩一区二区三区av | 国产成人精品综合 |