新增章节:[deque-数据布局和基本操作]

pull/571/head
sunface 3 years ago
commit 11cc4b1008

@ -4,13 +4,10 @@
- 官方: [https://course.rs](https://course.rs)
- 知乎: [支持章节内目录跳转,很好用!](https://www.zhihu.com/column/c_1452781034895446017)
- Rust语言社区: QQ群 1009730433
> 学习 Rust 光看书不够,精心设计的习题和项目实践可以让你事半功倍。[Rust By Practice](https://github.com/sunface/rust-by-practice) 是本书的配套习题和实践,覆盖了 easy to hard 各个难度,满足大家对 Rust 的所有期待。
>
> [Rust 语言周刊](https://github.com/sunface/rust-weekly),每周一发布,精选过去一周的技术文章、业界新闻、开源项目和 Rust 语言动态。
>
> Rust 优秀项目很多,如何在茫茫码海中与它们相遇?相比 Awesome Rust [Fancy Rust](https://github.com/sunface/fancy-rust) 能带给你全新的体验和选择。
- 本书配套项目
- [Rust 实战练习](https://github.com/sunface/rust-by-practice),它是本书的配套练习册,提供了大量有挑战性的示例、练习和实践项目,帮助大家解决 Rust 语言从学习到实战的问题 — 毕竟这之间还隔着好几个 Go 语言的难度 :D
- [Rust 语言周刊](https://github.com/sunface/rust-weekly),每周一发布,精选过去一周的技术文章、业界新闻、开源项目和 Rust 语言动态
- [Rust 酷库推荐](https://github.com/sunface/fancy-rust) Rust 优秀项目很多,如何在茫茫码海中与它们相遇?相比 Awesome Rust它能带给你全新的体验和选择
## 教程简介

@ -492,6 +492,7 @@ let sql = sql!(SELECT * FROM posts WHERE id=1);
3. [syn](https://crates.io/crates/syn) 和 [quote](https://crates.io/crates/quote) ,用于编写过程宏的包,它们的文档有很多值得学习的东西
4. [Structuring, testing and debugging procedural macro crates](https://www.reddit.com/r/rust/comments/rjumsg/any_good_resources_for_learning_rust_macros/)从测试、debug、结构化的角度来编写过程宏
5. [blog.turbo.fish](https://blog.turbo.fish),里面的过程宏系列文章值得一读
6. [Rust 宏小册中文版](https://zjp-cn.github.io/tlborm/),非常详细的解释了宏各种知识
## 总结

@ -323,7 +323,7 @@ impl<T> AsyncReceiver<T> {
除了跳转到标准库,你还可以通过指定具体的路径跳转到自己代码或者其它库的指定项,例如在 `lib.rs` 中添加以下代码:
```rust
mod a {
pub mod a {
/// `add_one` 返回一个[`Option`]类型
/// 跳转到[`crate::MySpecialFormatter`]
pub fn add_one(x: i32) -> Option<i32> {
@ -331,7 +331,7 @@ mod a {
}
}
struct MySpecialFormatter;
pub struct MySpecialFormatter;
```
使用 `crate::MySpecialFormatter` 这种路径就可以实现跳转到 `lib.rs` 中定义的结构体上。
@ -429,7 +429,7 @@ pub mod utils {
/// ```rust
/// use art::utils::mix;
/// use art::kinds::{PrimaryColor,SecondaryColor};
/// assert_eq!(mix(PrimaryColor::Yellow, PrimaryColor::Blue), SecondaryColor::Green)
/// assert!(matches!(mix(PrimaryColor::Yellow, PrimaryColor::Blue), SecondaryColor::Green));
/// ```
pub fn mix(c1: PrimaryColor, c2: PrimaryColor) -> SecondaryColor {
SecondaryColor::Green

@ -15,7 +15,7 @@
| 目录 | 描述 |
| ---------------- | ----------------------------------------------------------------------- |
| `target/debug/` | 包含了 `dev` profile 的构建输出(`cargo build` 或 `cargo build --debug`) |
| `target/release` | `release` profile 的构建输出,`cargo build --release` |
| `target/release/` | `release` profile 的构建输出,`cargo build --release` |
| `target/foo/` | 自定义 `foo` profile 的构建输出,`cargo build --profile=foo` |
出于历史原因:
@ -30,7 +30,7 @@
| 目录 | 示例 |
| -------------------------- | --------------------------------------- |
| `target/<triple>/debug` | `target/thumbv7em-none-eabihf/debug/` |
| `target/<triple>/debug/` | `target/thumbv7em-none-eabihf/debug/` |
| `target/<triple>/release/` | `target/thumbv7em-none-eabihf/release/` |
> **注意:**,当没有使用 `--target` 时,`Cargo` 会与构建脚本和过程宏一起共享你的依赖包,对于每个 `rustc` 命令调用而言,[`RUSTFLAGS`](https://course.rs/cargo/reference/configuration.html#配置文件概览) 也将被共享。

@ -39,7 +39,7 @@ members = [
**对于没有主 `package` 的场景或你希望将所有的 `package` 组织在单独的目录中时,这种方式就非常适合。**
例如 [rust-analyzer](https://github.com/rust-analyzer/rust-analyzer) 就是这样的项目,它的根目录中的 `Cargo.toml` 中并没有 `[package]`,说明该根目录不是一个 `package`,但是却有 `[workspacke]` :
例如 [rust-analyzer](https://github.com/rust-analyzer/rust-analyzer) 就是这样的项目,它的根目录中的 `Cargo.toml` 中并没有 `[package]`,说明该根目录不是一个 `package`,但是却有 `[workspace]` :
```toml
[workspace]

Loading…
Cancel
Save