rust语言基础

rust语言的优点

  • c/c++ 性能好,但是类型系统和内存都不太安全。
  • java/c#, 有GC,内存安全有很多优秀的特性,但性能不行。
  • Rust:安全,无需GC,易于维护

rust的缺点

  • 难学

Rust特别擅长的领域

  • 高性能Web Service
  • WebAssemble
  • 命令行工具
  • 网络编程
  • 嵌入式设备
  • 系统编程

Rust的用户和案例

  • Google:新操作系统Fuschia,Rust:30%
  • Amazon:基于Linux开发的直接可以在裸机、虚拟机上运行容器的操作系统
  • System76:纯Rust开发了下一代安全操作系统Redox
  • 蚂蚁金服:库操作系统Occlum
  • 斯坦福和密歇根大学:嵌入式实时操作系统,应用于Google的加密产品。
  • 微软:Rust重写Windows系统中的一些低级组件
  • 微软:WinRT/Rust项目
  • Dropbox、Yelp、LINE、npm、百度、华为、Deno等

注意

  • Rust有很多独有的概念,他们和现在大多主流语言都不通。
  • 学习Rust必须从基础概念一步一步学,否则会懵。

参考教材

  • Rust权威指南(The rust programming language)

Rust安装

curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
info: downloading installerWelcome to Rust!This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:/Users/zp/.rustupThis can be modified with the RUSTUP_HOME environment variable.The Cargo home directory is located at:/Users/zp/.cargoThis can be modified with the CARGO_HOME environment variable.The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:/Users/zp/.cargo/binThis path will then be added to your PATH environment variable by
modifying the profile files located at:/Users/zp/.profile/Users/zp/.bash_profile/Users/zp/.bashrc/Users/zp/.zshenvYou can uninstall at any time with rustup self uninstall and
these changes will be reverted.Current installation options:default host triple: x86_64-apple-darwindefault toolchain: stable (default)profile: defaultmodify PATH variable: yes1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>
  • 选1,提示如下则安装成功
info: profile set to 'default'
info: default host triple is x86_64-apple-darwin
info: syncing channel updates for 'stable-x86_64-apple-darwin'
703.5 KiB / 703.5 KiB (100 %) 671.4 KiB/s in  1s ETA:  0s
info: latest update on 2022-06-30, rust version 1.62.0 (a8314ef7d 2022-06-27)
info: downloading component 'cargo'4.7 MiB /   4.7 MiB (100 %)   2.8 MiB/s in  1s ETA:  0s
info: downloading component 'clippy'
info: downloading component 'rust-docs'18.3 MiB /  18.3 MiB (100 %)   5.3 MiB/s in  4s ETA:  0s
info: downloading component 'rust-std'24.6 MiB /  24.6 MiB (100 %)   4.0 MiB/s in  6s ETA:  0s
info: downloading component 'rustc'52.6 MiB /  52.6 MiB (100 %)   1.5 MiB/s in 20s ETA:  0s
info: downloading component 'rustfmt'2.4 MiB /   2.4 MiB (100 %)   1.4 MiB/s in  2s ETA:  0s
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'18.3 MiB /  18.3 MiB (100 %)   1.7 MiB/s in 21s ETA:  0s
info: installing component 'rust-std'24.6 MiB /  24.6 MiB (100 %)   8.9 MiB/s in  2s ETA:  0s
info: installing component 'rustc'52.6 MiB /  52.6 MiB (100 %)  10.4 MiB/s in  5s ETA:  0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-x86_64-apple-darwin'stable-x86_64-apple-darwin installed - rustc 1.62.0 (a8314ef7d 2022-06-27)Rust is installed now. Great!To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).To configure your current shell, run:
source "$HOME/.cargo/env"
  • 查看版本号
localhost:~ zp$ rustc --version
rustc 1.62.0 (a8314ef7d 2022-06-27)
  • 卸载
 rustup self uninstall

总结

  • 今天简单了解了一下rust语言,学习了rust语言的优点和缺点。
  • 学习了rust的下载安装和基本配置。
  • rust是一门安全又高效的语言,这个足以秒杀现在的大部分语言了。
  • 大厂都在用的语言,如果有时间还是有必要学习一下。

rust学习笔记-rust语言基础相关推荐

  1. PHP学习笔记-PHP语言基础3

    转载请标明出处: http://blog.csdn.net/hai_qing_xu_kong/article/details/50968247 本文出自:[顾林海的博客] 前言 大清早没什么事做,距离 ...

  2. PHP学习笔记-PHP语言基础2

    转载请标明出处: http://blog.csdn.net/hai_qing_xu_kong/article/details/50959797 本文出自:[顾林海的博客] 前言 这几天因为公司的变动, ...

  3. PHP学习笔记-PHP语言基础1

    转载请标明出处: http://blog.csdn.net/hai_qing_xu_kong/article/details/50951976 本文出自:[顾林海的博客] 前言 "合抱之木, ...

  4. MySQL学习笔记_8_SQL语言基础复习

    SQL语言基础复习 一.概述 SQL语句注释方式 1)以"#"开头直到行尾的所有内容都是注释 2)以"--"(--后还有一个空格)开头直到行尾的所有内容都是注释 ...

  5. 学习笔记3-C语言-基础

    C语言简介 发展史:BCPL -> new B -> C -> Minix -> Linux -> gcc C语言诞生: 1970年~1973年,在肯.汤姆逊和丹尼斯.里 ...

  6. nltk和python的关系_NLTK学习笔记(一):语言处理和Python

    目录 nltk资料下载 import nltk nltk.download() 其中,download() 参数默认是all,可以在脚本里面加上nltk.download(需要的资料库) 来进行下载 ...

  7. rust学习笔记中级篇1–泛型(霜之小刀)

    rust学习笔记中级篇1–泛型(霜之小刀) 欢迎转载和引用,若有问题请联系 若有疑问,请联系 Email : lihn1011@163.com QQ:2279557541 结构体泛型 首先上代码,如何 ...

  8. JavaScript学习笔记01【基础——简介、基础语法、运算符、特殊语法、流程控制语句】

    w3school 在线教程:https://www.w3school.com.cn JavaScript学习笔记01[基础--简介.基础语法.运算符.特殊语法.流程控制语句][day01] JavaS ...

  9. 菜鸟学习笔记:Java基础篇6(数组、字符串)

    菜鸟学习笔记:Java常用类(数组.字符串) 数组 概述 数组的定义 二维数组 数组查找和排序 查找 排序 数组运用--字符串 不可变字符序列(String) 可变字符序列(StringBuilder ...

最新文章

  1. String.slice和String.substring有什么区别?
  2. LeanCloud学习笔记(1)
  3. Hdu 2089-不要62 数位dp
  4. badboy测试工具下载
  5. 5个杰出的商业机器学习用例
  6. word_cloud
  7. Hinton胶囊网络代码正式开源,5天GitHub fork超1.4万
  8. sk hynix 固态硬盘 管理_5000MB/s 极速狂飙——希捷酷玩FireCuda 520 PCIE4.0 SSD固态硬盘体验...
  9. 吉林省辽源市谷歌高清卫星地图下载
  10. 彻底理解connection timeout
  11. 番茄花园 产业链 洪磊 中国
  12. uniapp图片加载不出来的解决方案
  13. 【MISCCFTSHOW总结】
  14. VB6 加载控件Windows Common Controls 6.0(mscomctl.ocx)失败提示“对象库未注册”
  15. 仿京东收货地址三级联动
  16. C# Winform 文本面板带滚动条
  17. 尚驰SHANGCHI洗车店兰州汽车美容店私人定制洗车服务 杜绝难看的洗车纹!
  18. ubuntu20下Cuckoo SandBox安装教程--大踩坑版(一)
  19. TMF和Frameworx
  20. 查看会计科目,ccid,和科目描述

热门文章

  1. C++字符串完全指南(转载)
  2. 如何把网站添加到手机主屏幕 website Add to Home Screen
  3. 温州医科大学oracle期末试题,系统解剖学期末复习(温州医科大学)系解试题A卷.doc...
  4. mysql求班级男女比例_目前班级里的男女比例如何?
  5. 多态 (多态的用处,意义,应用)
  6. XTU 1268 Strange Optimization 2017年“嘉杰信息杯” 中国大学生程序设计竞赛全国邀请赛(湖南)
  7. 灰色关联度分析(python)
  8. ORACLE SQL数据类型转换
  9. 【RtpPacketReceived】RTP/UDP包接收并异步处理的封装类:MediaPacketObserverWrapper
  10. 用puppeteer获取class=news mt10下li标签下的a标签的值和链接另一种方法