Rust 课程笔记
background
Rust 社区很给力各种渠道中,有各种教程, 只是, 每个教程都有自己的特点和盲区...
goal
高速刷过时, 见到有趣/有用/有种的片段, 收集摘录在一起, 形成自己的小抄...
trace
init.
Recommended tools:
- cargo readme - to regenerate README.md based on template and lib.rs comments
- cargo insta - to review test snapshots
- cargo edit - to add/remove dependencies
- cargo fmt - to format code
-
cargo clippy - for all insights and tips
- 安装:rustup component add clippy
- 参考: Rustup Book学习笔记 | Rust学习笔记
- 如果出问题:
- Fresh install on macos can't install rustfmt and clippy using rustup · Issue #1558 · rust-lang/rustup
- rustup toolchain remove stable && rustup toolchain install stable
- ...
info: syncing channel updates for 'stable-x86_64-apple-darwin'
info: latest update on 2023-02-09, rust version 1.67.1 (d5a82bbd2 2023-02-07)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
...
stable-x86_64-apple-darwin installed - rustc 1.67.1 (d5a82bbd2 2023-02-07)
info: checking for self-updates
- cargo fix - for fixing warnings
检验和切换工具链
查实当前使用的工具链:
rustup toolchain list
安装指定工具链:
rustup toolchain install nightly-x86_64-unknown-linux-gnu
宏查阅
~ dtolnay/cargo-expand: Subcommand to show result of macro expansion
使用:
crago expand
在终端中展开宏并打印...如果工程大点儿, 就不可看了...
project
CLI
~ A command line app in 15 minutes - Command Line Applications in Rust
还是老习惯, CLI->RESTful->GUI-> ...
debug
dbg!()
类似 ic 的工具, 可以随时插入代码, 并在运行时打印对应变量名和值...
testting
coding
refer:
Udemy
- The Complete Rust Programming Course | Udemy
- Learn Rust by Building Real Applications | Udemy
- 用了一半篇幅来介绍内存管理模型,以及 GDB 观察过程...
Youtube
- 110+Rust 编程语言入门教程 [2021] - YouTube
- 44+The Rust Lang Book - YouTube
- 25+Rust Projects - YouTube
- Jon Gjengset - YouTube
- Rust live-coding - YouTube
- 都是几个小时的连续调试过程
- Crust of Rust - YouTube
- Rust live-coding - YouTube
_~`|-~_
\/ / - = \ \/
'_ ⏝ _'
( '--~--' /
...act by ferris-actor v0.2.4 (built on 23.0303.201916)