|
|
|
|
# Rust语言圣经
|
|
|
|
|
|
|
|
|
|
[进入Rust编程世界](into-rust.md)
|
|
|
|
|
[关于本书](about-book.md)
|
|
|
|
|
[避免从入门到放弃](sth-you-should-not-do.md)
|
|
|
|
|
|
|
|
|
|
## Getting started
|
|
|
|
|
|
|
|
|
|
- [寻找牛刀,以便小试](first-try/intro.md)
|
|
|
|
|
- [安装Rust环境](first-try/installation.md)
|
|
|
|
|
- [墙推VSCode!](first-try/editor.md)
|
|
|
|
|
- [认识Cargo](first-try/cargo.md)
|
|
|
|
|
- [不仅仅是Hello world](first-try/hello-world.md)
|
|
|
|
|
|
|
|
|
|
## Rust学习三部曲
|
|
|
|
|
|
|
|
|
|
- [Rust基础入门](basic/intro.md)
|
|
|
|
|
- [变量绑定与解构](basic/variable.md)
|
|
|
|
|
- [基本类型](basic/base-type/index.md)
|
|
|
|
|
- [数值类型](basic/base-type/numbers.md)
|
|
|
|
|
- [字符、布尔、单元类型](basic/base-type/char-bool.md)
|
|
|
|
|
- [语句与表达式](basic/base-type/statement-expression.md)
|
|
|
|
|
- [函数](basic/base-type/function.md)
|
|
|
|
|
- [所有权和借用](basic/ownership/index.md)
|
|
|
|
|
- [所有权](basic/ownership/ownership.md)
|
|
|
|
|
- [引用与借用](basic/ownership/borrowing.md)
|
|
|
|
|
- [复合类型](basic/compound-type/intro.md)
|
|
|
|
|
- [字符串与切片](basic/compound-type/string-slice.md)
|
|
|
|
|
- [元组](basic/compound-type/tuple.md)
|
|
|
|
|
- [结构体](basic/compound-type/struct.md)
|
|
|
|
|
- [枚举](basic/compound-type/enum.md)
|
|
|
|
|
- [数组](basic/compound-type/array.md)
|
|
|
|
|
- [流程控制](basic/flow-control.md)
|
|
|
|
|
- [模式匹配](basic/match-pattern/intro.md)
|
|
|
|
|
- [match和if let](basic/match-pattern/match-if-let.md)
|
|
|
|
|
- [解构Option](basic/match-pattern/option.md)
|
|
|
|
|
- [模式适用场景](basic/match-pattern/pattern-match.md)
|
|
|
|
|
- [全模式列表](basic/match-pattern/all-patterns.md)
|
|
|
|
|
- [方法Method](basic/method.md)
|
|
|
|
|
- [泛型和特征](basic/trait/intro.md)
|
|
|
|
|
- [泛型Generics](basic/trait/generic.md)
|
|
|
|
|
- [特征Trait](basic/trait/trait.md)
|
|
|
|
|
- [特征对象](basic/trait/trait-object.md)
|
|
|
|
|
- [进一步深入特征](basic/trait/advance-trait.md)
|
|
|
|
|
- [集合类型](basic/collections/intro.md)
|
|
|
|
|
- [动态数组Vector](basic/collections/vector.md)
|
|
|
|
|
- [KV存储HashMap](basic/collections/hashmap.md)
|
|
|
|
|
- [类型转换](basic/converse.md)
|
|
|
|
|
- [返回值和错误](basic/result-error/intro.md)
|
|
|
|
|
- [panic深入剖析!](basic/result-error/panic.md)
|
|
|
|
|
- [返回值Result和?](basic/result-error/result.md)
|
|
|
|
|
|
|
|
|
|
- [Rust高级进阶](advance/intro.md)
|
|
|
|
|
- [生命周期](advance/lifetime/intro.md)
|
|
|
|
|
- [认识生命周期](advance/lifetime/basic.md)
|
|
|
|
|
- [深入生命周期](advance/lifetime/advance.md)
|
|
|
|
|
<!-- - [一些关于生命周期的误解 todo](advance/lifetime/misconceptions.md) -->
|
|
|
|
|
- [函数式编程](advance/functional-programing/intro.md)
|
|
|
|
|
- [闭包closure](advance/functional-programing/closure.md)
|
|
|
|
|
- [迭代器iterator](advance/functional-programing/iterator.md)
|
|
|
|
|
- [包和模块](advance/crate-module/intro.md)
|
|
|
|
|
- [包crate](advance/crate-module/crate.md)
|
|
|
|
|
- [模块Module](advance/crate-module/module.md)
|
|
|
|
|
- [使用use引入模块及受限可见性](advance/crate-module/use.md)
|
|
|
|
|
- [注释和文档](advance/comment.md)
|
|
|
|
|
- [深入类型之newtype和Sized](advance/custom-type.md)
|
|
|
|
|
- [格式化输出](advance/formatted-output.md)
|
|
|
|
|
- [智能指针](advance/smart-pointer/intro.md)
|
|
|
|
|
- [Box<T>堆对象分配](advance/smart-pointer/box.md)
|
|
|
|
|
- [Deref解引用](advance/smart-pointer/deref.md)
|
|
|
|
|
- [Drop释放资源](advance/smart-pointer/drop.md)
|
|
|
|
|
- [Rc与Arc实现1vN所有权机制](advance/smart-pointer/rc-arc.md)
|
|
|
|
|
- [Cell与RefCell内部可变性](advance/smart-pointer/cell-refcell.md)
|
|
|
|
|
- [循环引用与自引用](advance/circle-self-ref/intro.md)
|
|
|
|
|
- [Weak与循环引用](advance/circle-self-ref/circle-reference.md)
|
|
|
|
|
- [结构体中的自引用](advance/circle-self-ref/self-referential.md))
|
|
|
|
|
- [多线程并发编程](advance/concurrency-with-threads/intro.md)
|
|
|
|
|
- [并发和并行](advance/concurrency-with-threads/concurrency-parallelism.md)
|
|
|
|
|
- [使用多线程](advance/concurrency-with-threads/thread.md)
|
|
|
|
|
- [线程同步:消息传递](advance/concurrency-with-threads/message-passing.md)
|
|
|
|
|
- [线程同步:锁、Condvar和信号量](advance/concurrency-with-threads/sync1.md)
|
|
|
|
|
- [线程同步:Atomic原子操作与内存顺序](advance/concurrency-with-threads/sync2.md)
|
|
|
|
|
- [基于Send和Sync的线程安全](advance/concurrency-with-threads/send-sync.md)
|
|
|
|
|
- [实践应用:多线程Web服务器 todo](advance/concurrency-with-threads/web-server.md)
|
|
|
|
|
- [全局变量](advance/global-variable.md)
|
|
|
|
|
- [错误处理 todo](advance/errors/intro.md)
|
|
|
|
|
- [简化错误处理 todo](advance/errors/simplify.md)
|
|
|
|
|
- [自定义错误 todo](advance/errors/user-define.md)
|
|
|
|
|
- [让错误输出更优雅 todo](advance/errors/pretty-format.md)
|
|
|
|
|
- [会导致panic的代码 todo](advance/errors/panic-codes.md)
|
|
|
|
|
<!-- - [高阶特征约束(HRTB) todo](advance/hrtb.md) -->
|
|
|
|
|
|
|
|
|
|
## 专题内容,每个专题都配套一个小型项目进行实践
|
|
|
|
|
- [async/await异步编程](async/intro.md)
|
|
|
|
|
- [async编程入门](async/getting-started.md)
|
|
|
|
|
- [底层探秘: Future执行与任务调度](async/future-excuting.md)
|
|
|
|
|
- [定海神针Pin和Unpin](async/pin-unpin.md)
|
|
|
|
|
- [async/await和Stream流处理](async/async-await.md)
|
|
|
|
|
- [同时运行多个Future](async/multi-futures-simultaneous.md)
|
|
|
|
|
- [一些疑难问题的解决办法](async/pain-points-and-workarounds.md)
|
|
|
|
|
- [实践应用:Async Web服务器](async/web-server.md)
|
|
|
|
|
|
|
|
|
|
- [tokio使用指南 doing](tokio/intro.md)
|
|
|
|
|
- [tokio概览](tokio/overview.md)
|
|
|
|
|
- [使用初印象](tokio/getting-startted.md)
|
|
|
|
|
- [创建异步任务](tokio/spawning.md)
|
|
|
|
|
- [共享状态](tokio/shared-state.md)
|
|
|
|
|
- [消息传递](tokio/channels.md)
|
|
|
|
|
- [I/O](tokio/io.md)
|
|
|
|
|
- [解析数据帧](tokio/frame.md)
|
|
|
|
|
- [深入async](tokio/async.md)
|
|
|
|
|
- [select](tokio/select.md)
|
|
|
|
|
- [类似迭代器的Stream](tokio/stream.md))
|
|
|
|
|
- [优雅的关闭](tokio/graceful-shutdown.md)
|
|
|
|
|
- [异步跟同步共存](tokio/bridging-with-sync.md)
|
|
|
|
|
|
|
|
|
|
- [Unsafe Rust todo](unsafe/intro.md)
|
|
|
|
|
- [原生指针 todo](unsafe/raw-pointer.md)
|
|
|
|
|
- [FFI外部语言用 todo](unsafe/ffi.md)
|
|
|
|
|
|
|
|
|
|
- [对抗编译检查 doing](fight-with-compiler/intro.md)
|
|
|
|
|
- [幽灵数据(todo)](fight-with-compiler/phantom-data.md)
|
|
|
|
|
- [生命周期](fight-with-compiler/lifetime/intro.md)
|
|
|
|
|
- [生命周期过大-01](fight-with-compiler/lifetime/too-long1.md)
|
|
|
|
|
- [生命周期过大-02](fight-with-compiler/lifetime/too-long2.md)
|
|
|
|
|
- [循环中的生命周期](fight-with-compiler/lifetime/loop.md)
|
|
|
|
|
- [闭包碰到特征对象-01](fight-with-compiler/lifetime/closure-with-static.md)
|
|
|
|
|
- [重复借用](fight-with-compiler/borrowing/intro.md)
|
|
|
|
|
- [同时在函数内外使用引用](fight-with-compiler/borrowing/ref-exist-in-out-fn.md)
|
|
|
|
|
- [智能指针引起的重复借用错误](fight-with-compiler/borrowing/borrow-distinct-fields-of-struct.md)
|
|
|
|
|
- [类型未限制(todo)](fight-with-compiler/unconstrained.md)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- [Rust陷阱系列](pitfalls/index.md)
|
|
|
|
|
- [for循环中使用外部数组](pitfalls/use-vec-in-for.md)
|
|
|
|
|
- [线程类型导致的栈溢出](pitfalls/stack-overflow.md)
|
|
|
|
|
- [算术溢出导致的panic](pitfalls/arithmetic-overflow.md)
|
|
|
|
|
- [闭包中奇怪的生命周期](pitfalls/closure-with-lifetime.md)
|
|
|
|
|
- [可变变量不可变?](pitfalls/the-disabled-mutability.md)
|
|
|
|
|
- [可变借用失败引发的深入思考](pitfalls/multiple-mutable-references.md)
|
|
|
|
|
- [不太勤快的迭代器](pitfalls/lazy-iterators.md)
|
|
|
|
|
- [奇怪的序列x..y](pitfalls/weird-ranges.md)
|
|
|
|
|
- [无处不在的迭代器](pitfalls/iterator-everywhere.md)
|
|
|
|
|
- [线程间传递消息导致主线程无法结束](pitfalls/main-with-channel-blocked.md)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- [Rust最佳实践 doing](practice/intro.md)
|
|
|
|
|
- [日常开发三方库精选](practice/third-party-libs.md)
|
|
|
|
|
- [一些写代码的技巧 todo](practice/coding-tips.md)
|
|
|
|
|
- [最佳实践 todo](practice/best-pratice.md)
|
|
|
|
|
- [值得学习的源代码 todo](practice/good-sourcecode.md)
|
|
|
|
|
- [代码规范 doing](practice/style-guide/intro.md)
|
|
|
|
|
- [命名规范](practice/style-guide/naming.md)
|
|
|
|
|
- [代码风格(todo)](practice/style-guide/code.md)
|
|
|
|
|
- [代码标记 todo](practice/style-guide/mark.md)
|
|
|
|
|
- [Clippy todo](practice/style-guide/clippy.md)
|
|
|
|
|
|
|
|
|
|
- [如何实现一个链表 todo]()
|
|
|
|
|
|
|
|
|
|
- [高级类型转换](converse/intro.md)
|
|
|
|
|
- [枚举和整数](converse/enum-int.md)
|
|
|
|
|
|
|
|
|
|
<!-- - [复杂错误索引 todo](errorindex/intro.md)
|
|
|
|
|
- [所有权和借用 todo](errorindex/borrowing/intro.md)
|
|
|
|
|
- [生命周期 todo](errorindex/lifetime/intro.md) -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- [Cargo详解 todo](cargo/intro.md)
|
|
|
|
|
- [常用命令 todo](cargo/commands.md)
|
|
|
|
|
- [项目结构 todo](cargo/layout.md)
|
|
|
|
|
- [Cargo.toml和Cargo.lock todo](cargo/cargo-toml-lock.md)
|
|
|
|
|
- [依赖管理 todo](cargo/dependency.md)
|
|
|
|
|
- [构建缓存 todo](cargo/cache.md)
|
|
|
|
|
- [版本管理 todo](cargo/version.md)
|
|
|
|
|
- [工作空间 todo](cargo/workspace.md)
|
|
|
|
|
- [条件编译、条件依赖 todo](cargo/feature.md)
|
|
|
|
|
- [配置参数 todo](cargo/manifest.md)
|
|
|
|
|
- [自定义构建脚本 todo](cargo/build-js.md)
|
|
|
|
|
- [Cargo profile todo](cargo/profile.md)
|
|
|
|
|
|
|
|
|
|
- [测试 todo](test/intro.md)
|
|
|
|
|
- [单元测试 todo](test/unit.md)
|
|
|
|
|
- [集成测试 todo](test/intergration.md)
|
|
|
|
|
- [性能测试 todo](test/benchmark.md)
|
|
|
|
|
- [持续集成 todo](test/ci.md)
|
|
|
|
|
|
|
|
|
|
- [常见特征解析 todo](traits/intro.md)
|
|
|
|
|
- [类型转换From/Into todo](traits/from-into.md)
|
|
|
|
|
- [AsRef, AsMut todo](traits/as-ref-as-mut.md)
|
|
|
|
|
- [Borrow, BorrowMut, ToOwned todo](traits/borrow-family.md)
|
|
|
|
|
- [Deref和引用隐式转换 todo](traits/deref.md)
|
|
|
|
|
- [写时拷贝Cow todo](traits/cow.md)
|
|
|
|
|
- [Eq todo](traits/eq.md)
|
|
|
|
|
|
|
|
|
|
- [深入内存 todo](memory/intro.md)
|
|
|
|
|
- [指针和引用 todo](memory/pointer-ref.md)
|
|
|
|
|
- [未初始化内存 todo](memory/uninit.md)
|
|
|
|
|
- [内存分配 todo](memory/allocation.md)
|
|
|
|
|
- [内存布局 todo](memory/layout.md)
|
|
|
|
|
- [虚拟内存 todo](memory/virtual.md)
|
|
|
|
|
|
|
|
|
|
- [Web应用开发 todo](web/intro.md)
|
|
|
|
|
- [编解码与序列化 todo](web/serialization.md)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- [面向对象 todo](object-oriented/intro.md)
|
|
|
|
|
- [为何OO todo](object-oriented/characteristics.md)
|
|
|
|
|
- [设计模式 todo](object-oriented/design-pattern.md)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- [宏编程 todo](macro/intro.md)
|
|
|
|
|
- [过程宏(todo)](macro/procedure-macro.md)
|
|
|
|
|
|
|
|
|
|
- [性能调优 doing](performance/intro.md)
|
|
|
|
|
- [深入理解move](performance/deep-into-move.md)
|
|
|
|
|
- [糟糕的提前优化 todo](performance/early-optimise.md)
|
|
|
|
|
- [Clone和Copy todo](performance/clone-copy.md)
|
|
|
|
|
- [Benchmark性能测试(todo)](performance/benchmark.md)
|
|
|
|
|
- [减少Runtime check(todo)](performance/runtime-check.md)
|
|
|
|
|
- [CPU缓存性能优化 todo](performance/cpu-cache.md)
|
|
|
|
|
- [计算性能优化 todo](performance/calculate.md)
|
|
|
|
|
- [堆和栈 todo](performance/heap-stack.md)
|
|
|
|
|
- [内存allocator todo](performance/allocator.md)
|
|
|
|
|
- [常用性能测试工具 todo](performance/tools.md)
|
|
|
|
|
- [Enum内存优化 todo](performance/enum.md)
|
|
|
|
|
|
|
|
|
|
- [编译器 todo](compiler/intro.md)
|
|
|
|
|
- [常见属性标记 todo](compiler/attributes.md)
|
|
|
|
|
- [提升编译速度 todo](compiler/speed-up.md)
|
|
|
|
|
- [编译器优化 todo](compiler/optimization/intro.md)
|
|
|
|
|
- [Option枚举 todo](compiler/optimization/option.md)
|
|
|
|
|
|
|
|
|
|
- [日志和监控 todo](monitor/intro.md)
|
|
|
|
|
- [日志 todo](monitor/log.md)
|
|
|
|
|
- [可观测性 todo](monitor/observability.md)
|
|
|
|
|
- [监控(APM) todo](monitor/apm.md)
|
|
|
|
|
|
|
|
|
|
- [标准库解析 todo](std/intro.md)
|
|
|
|
|
- [标准库使用最佳时间 todo](std/search.md)
|
|
|
|
|
- [Vector常用方法 todo](std/vector.md)
|
|
|
|
|
- [HashMap todo](std/hashmap.md)
|
|
|
|
|
- [Iterator常用方法 todo](std/iterator.md)
|
|
|
|
|
|
|
|
|
|
- [Rust区块链入门]()
|
|
|
|
|
- [Rust游戏开发入门]()
|
|
|
|
|
- [Rust前端开发入门]()
|
|
|
|
|
- [Rust和WASM]()
|
|
|
|
|
|
|
|
|
|
## 附录
|
|
|
|
|
- [附录](appendix/intro.md)
|
|
|
|
|
- [A-关键字](appendix/keywords.md)
|
|
|
|
|
- [B-运算符与符号](appendix/operators.md)
|
|
|
|
|
- [C-表达式](appendix/expressions.md)
|
|
|
|
|
- [D-派生特征derive](appendix/derive.md)
|
|
|
|
|
- [E-prelude模块 todo](appendix/prelude.md)
|
|
|
|
|
- [F-难点索引](appendix/difficulties.md)
|
|
|
|
|
- [G-Rust版本说明](appendix/rust-version.md)
|
|
|
|
|
- [H-Rust更新版本列表](appendix/rust-versions/intro.md)
|
|
|
|
|
- [1.58](appendix/rust-versions/1.58.md)
|