安装 Rust

在 Unix 类系统如 Linux 和 macOS 上,打开终端并输入:

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: /root/.cargo/bin This path will then be added to your PATH environment variable by modifying the
profile files located at: /root/.profile
/root/.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 ) Proceed with installation (default)
) Customize installation
) Cancel installation

选择 1 ,回车继续;

这样会下载一个脚本并开始安装。如果一切顺利,你将会看到:

Current installation options:

   default host triple: x86_64-unknown-linux-gnu
default toolchain: stable
modify PATH variable: yes ) Proceed with installation (default)
) Customize installation
) Cancel installation
> info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
334.4 KiB / 334.4 KiB ( %) 191.0 KiB/s ETA: s
info: latest update on --, rust version 1.34. (6c2484dc3 --)
info: downloading component 'rustc'
85.3 MiB / 85.3 MiB ( %) 172.7 KiB/s ETA: s
info: downloading component 'rust-std'
56.1 MiB / 56.1 MiB ( %) 182.4 KiB/s ETA: s
info: downloading component 'cargo'
4.3 MiB / 4.3 MiB ( %) 188.8 KiB/s ETA: s
info: downloading component 'rust-docs'
10.2 MiB / 10.2 MiB ( %) 169.4 KiB/s ETA: s
info: installing component 'rustc'
85.3 MiB / 85.3 MiB ( %) 12.8 MiB/s ETA: s
info: installing component 'rust-std'
56.1 MiB / 56.1 MiB ( %) 13.3 MiB/s ETA: s
info: installing component 'cargo'
info: installing component 'rust-docs'
10.2 MiB / 10.2 MiB ( %) 1.2 MiB/s ETA: s
info: default toolchain set to 'stable' stable installed - rustc 1.34. (6c2484dc3 --) 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

如上显示代表安装完成;

rust卸载

卸载 Rust 跟安装它一样容易:
rustup self uninstall

第一个Rust程序

依据惯例,打印hello,world

编辑创建文件main.rs

fn main() {
println!("Hello, world!");
}

编译(类似于C语言的gcc编译):

rustc  main.rs

运行:

./main

输出:

Hello, world!

最新文章

  1. 利用CNN进行人脸年龄预测
  2. jsonkit mrc于arc混编
  3. Sublime Text3 C++及Java开发环境配置
  4. Zbrush遮罩边界该怎么实现羽化和锐化
  5. Adobe Flash Platform产品介绍
  6. Python内存管理及引用计数
  7. [转载]SQL字符串处理函数大全
  8. SqlServer将数据库中的表复制到另一个数据库
  9. php mysql 数据库写入与读取取文件
  10. 按钮(Buton)组价的功能和用法
  11. python3网络编程之socket
  12. webpack的css压缩不兼容IOS8问题探索
  13. HashMap源码分析(一)
  14. springboot格式化时间
  15. 【js字符串当做数组来使用】浪费一晚【想出了3个解决方案】
  16. 天使投资、A轮、B轮、C轮
  17. Spring Boot集成JasperReports生成PDF文档
  18. scala 学习笔记十 元组
  19. fastdfs 上传和下载 有用
  20. JFrame上添加、删除Jpanel后动态显示界面问题

热门文章

  1. LeetCode算法题-Backspace String Compare(Java实现)
  2. 【Linux开发】Linux及Arm-Linux程序开发笔记(零基础入门篇)
  3. ipad已停用 连接itunes怎么办
  4. jenkins shell 取当前时间
  5. Docker数据持久化及实战(Nginx+Spring Boot项目+MySQL)
  6. centos7安装nginx并配置前端环境
  7. Linux如何设置在当前目录下打开终端
  8. checkbox的全选、全消的使用
  9. neo4j 初探
  10. Xdex(百度版)脱壳工具基本原理