diff --git a/CNAME b/CNAME index 0d31bdab..43b51246 100644 --- a/CNAME +++ b/CNAME @@ -1 +1 @@ -wayto.rs \ No newline at end of file +course.rs \ No newline at end of file diff --git a/README.md b/README.md index 560520a2..373cf483 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Rust编程指南 +# Rust语言圣经 -- 官方书名: Rust编程指南(Rust Course) +- 官方书名: Rust语言圣经(Rust Course) - 官方网址: https://course.rs - 修订时间: **尚未发行** - Rust版本:Rust edition 2021 @@ -8,7 +8,7 @@ ## 关于本书 #### 书本简介 -`Rust编程指南`是一本涵盖了从入门到精通各个阶段的Rust书籍,书本的章节和内容组织经过深思熟虑的设计,以符合中国用户的编程使用习惯,目的是尽量对新手更友好,同时也更方便老手的后期检索查询。 +`Rust语言圣经`是一本涵盖了从入门到精通各个阶段的Rust书籍,书本的章节和内容组织经过深思熟虑的设计,以符合中国用户的编程使用习惯,目的是尽量对新手更友好,同时也更方便老手的后期检索查询。 使用Rust的用户往往都对性能非常感兴趣,因此本书对于性能优化方面也是分散落入各个章节中,同时还有一个专门的**性能优化**专题,来帮助用户系统的认识如何优化Rust项目的性能。 @@ -47,7 +47,7 @@ Rust的外部库层次不齐,针对这一点,我们根据功能分类推荐 ## 开源版权说明 -Rust编程指南是完全开源的电子书籍,但是也应该受到版权的保护,毕竟凝聚了大家多个数以百计小时的汗水、牺牲了大量陪伴家人的时间,才完成了该书。 +Rust语言圣经是完全开源的电子书籍,但是也应该受到版权的保护,毕竟凝聚了大家多个数以百计小时的汗水、牺牲了大量陪伴家人的时间,才完成了该书。 因此我们选择了[No License](https://www.google.com.hk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwigkv-KtMT0AhXFdXAKHdI4BCcQFnoECAQQAw&url=https%3A%2F%2Fchoosealicense.com%2Fno-permission%2F&usg=AOvVaw3M2Q4IbdhnpJ2K71TF7SPB)作为我们的版权,这意味着读者可以随意的fork、阅读,但是不能私下修改后再分发,如果想要修改,请提RP或者加入Rust编程学院,成为正式成员。 diff --git a/book.toml b/book.toml index 1ce02801..c3a70f9b 100644 --- a/book.toml +++ b/book.toml @@ -1,7 +1,7 @@ [book] authors = ["sunface"] language = "zh-CN" -title = "Rust编程指南(Rust Course)" +title = "Rust语言圣经(Rust Course)" [output.html] additional-css = ["assets/ferris.css", "assets/theme/2018-edition.css"] diff --git a/src/SUMMARY.md b/src/SUMMARY.md index feef69a1..7527e5c4 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -1,6 +1,6 @@ -# Rust编程指南 +# Rust语言圣经 -[Rust编程指南](about-book.md) +[Rust语言圣经](about-book.md) [进入Rust编程世界](into-rust.md) ## Getting started diff --git a/src/about-book.md b/src/about-book.md index bfdcefb3..f6042d71 100644 --- a/src/about-book.md +++ b/src/about-book.md @@ -1,17 +1,17 @@ -# Rust编程指南 +# Rust语言圣经 做任何事情,初心和目标很重要,过程也很重要,那么这里我们就来谈谈这些,关于书,关于Rust在国内的发展。*强烈建议读者大大们不要跳过下面的内容,对于你对这本书的理解和定位会很有帮助*。 ## 关于本书 -- 官方书名: Rust编程指南(Rust Course) +- 官方书名: Rust语言圣经(Rust Course) - 官方网址: https://course.rs - 修订时间: 尚未发行 - Rust版本:Rust edition 2021 - QQ交流群: 1009730433 #### 书本简介 -`Rust编程指南`是一本涵盖了从入门到精通各个阶段的Rust书籍,书本的章节和内容组织经过深思熟虑的设计,以符合中国用户的编程使用习惯,目的是尽量对新手更友好,同时也更方便老手的后期检索查询。 +`Rust语言圣经`是一本涵盖了从入门到精通各个阶段的Rust书籍,书本的章节和内容组织经过深思熟虑的设计,以符合中国用户的编程使用习惯,目的是尽量对新手更友好,同时也更方便老手的后期检索查询。 使用Rust的用户往往都对性能非常感兴趣,因此本书对于性能优化方面也是分散落入各个章节中,同时还有一个专门的[性能优化](./performance/intro.md)专题,来帮助用户系统的认识如何优化Rust项目的性能。 @@ -49,7 +49,7 @@ Rust的外部库层次不齐,针对这一点,我们根据功能分类推荐 ## 版权信息 -Rust编程指南是完全开源的电子书籍,但是也应该受到版权的保护,毕竟凝聚了大家多个数以百计小时的汗水、牺牲了大量陪伴家人的时间,才完成了该书。 +Rust语言圣经是完全开源的电子书籍,但是也应该受到版权的保护,毕竟凝聚了大家多个数以百计小时的汗水、牺牲了大量陪伴家人的时间,才完成了该书。 因此我们选择了[No License](https://www.google.com.hk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwigkv-KtMT0AhXFdXAKHdI4BCcQFnoECAQQAw&url=https%3A%2F%2Fchoosealicense.com%2Fno-permission%2F&usg=AOvVaw3M2Q4IbdhnpJ2K71TF7SPB)作为我们的版权,这意味着读者可以随意的fork、阅读,但是不能私下修改后再分发,如果想要修改,请提RP或者加入Rust编程学院,成为正式成员。 diff --git a/src/appendix/operators.md b/src/appendix/operators.md index 9a46fcf6..fcde37ae 100644 --- a/src/appendix/operators.md +++ b/src/appendix/operators.md @@ -15,8 +15,8 @@ | `!` | `ident!(...)`, `ident!{...}`, `ident![...]` | 宏展开 | | | `!` | `!expr` | 按位非或逻辑非 | `Not` | | `!=` | `var != expr` | 不等比较 | `PartialEq` | -| `%` | `expr % expr` | 算术取模 | `Rem` | -| `%=` | `var %= expr` | 算术取模与赋值 | `RemAssign` | +| `%` | `expr % expr` | 算术求余 | `Rem` | +| `%=` | `var %= expr` | 算术求余与赋值 | `RemAssign` | | `&` | `&expr`, `&mut expr` | 借用 | | | `&` | `&type`, `&mut type`, `&'a type`, `&'a mut type` | 借用指针类型 | | | `&` | `expr & expr` | 按位与 | `BitAnd` | diff --git a/src/errors/panic.md b/src/errors/panic.md index b82dd9af..d95f8cc4 100644 --- a/src/errors/panic.md +++ b/src/errors/panic.md @@ -1 +1,11 @@ # panic! + + +## panic背后的原理 + +Not sure exactly what you're asking, but I'll try to describe the panic mechanism as I understand it. I'm sure folks will correct my mistakes. +When you call the panic!() macro it formats the panic message and then calls std::panic::panic_any() with the message as the argument. panic_any() first checks to see if there's a "panic hook" installed by the application: if so, the hook function is called. Assuming that the hook function returns, the unwinding of the current thread begins with the parent stack frame of the caller of panic_any(). If the registers or the stack are messed up, likely trying to start unwinding will cause an exception of some kind, at which point the thread will be aborted instead of unwinding. +Unwinding is a process of walking back up the stack, frame-by-frame. At each frame, any data owned by the frame is dropped. (I believe things are dropped in reverse static order, as they would be at the end of a function.) +One exceptional case during unwinding is that the unwinding may hit a frame marked as "catching" the unwind via std::panic::catch_unwind(). If so, the supplied catch function is called and unwinding ceases: the catching frame may continue the unwinding with std::panic::resume_unwind() or not. +Another exceptional case during unwinding is that some drop may itself panic. In this case the unwinding thread is aborted. +Once unwinding of a thread is aborted or completed (no more frames to unwind), the outcome depends on which thread panicked. For the main thread, the operating environment's abort functionality is invoked to terminate the panicking process via core::intrinsics::abort(). Child threads, on the other hand, are simply terminated and can be collected later with std::thread::join() \ No newline at end of file diff --git a/src/some-thoughts.md b/src/some-thoughts.md index 63b20351..367171d9 100644 --- a/src/some-thoughts.md +++ b/src/some-thoughts.md @@ -1 +1 @@ -# Rust编程指南 +# Rust语言圣经