Rust 课程笔记

background

Rust 社区很给力各种渠道中,有各种教程, 只是, 每个教程都有自己的特点和盲区...

goal

高速刷过时, 见到有趣/有用/有种的片段, 收集摘录在一起, 形成自己的小抄...

trace

init.

Recommended tools:

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

检验和切换工具链

~ Learn-Rust-by-Building-Real-Applications/memory_management at master · gavadinov/Learn-Rust-by-Building-Real-Applications

查实当前使用的工具链:

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

Youtube

      _~`|-~_
  \/ /  - =  \ \/
    '_   ⏝   _'
    ( '--~--' /

...act by ferris-actor v0.2.4 (built on 23.0303.201916)

知识共享许可协议 本作品采用知识共享署名-相同方式共享 4.0 国际许可协议进行许可;-)