Leanpub Header

Skip to main content

Rust By Example 中文注解版

Rust入门的正确姿势,完全参照官网内容

  1. 简单、准确,完全参考官网材料1:1编写;
  2. 完整,全面覆盖Rust的重要特性和知识;
  3. 及时迭代更新,对错误的、过时的内容和新增的内容及时更新发布新版本;
  4. 初学者不需要搭建复杂的开发环境,可以直接在官网网页的playground上面运行.
  5. 降低挫败感,持续学习,提升学习效率和体验。

Minimum price

$7.99

$29.00

You pay

$29.00

Author earns

$23.20
$

...Or Buy With Credits!

You can get credits monthly with a Reader Membership
PDF
EPUB
About

About

About the Book

导读

本书面向的读者,最好有C/C++基础,了解现代C++的各种概念。如果没有C/C++基础也没有关系,Rust远没有C/C++那么复杂。

重点章节:14,15,16 这个是Rust语言的特色部分,也是难点部分,必须要掌握,否则在阅读源码或者使用库的时候,会产生很多疑惑。

我尽力用最简单的语言将原作者要表达的语义表达清晰、准确。但我在注解的过程中,也发现,有些地方,我怎么解释也讲不清楚。这可能本身就是语言的复杂信。英文的表达比较简练,加上必须对Rust有深入的了解,才能有更好的注解。虽然作者对现代C++语言知识比较有自信,但是我也深知,对语言的真正理解来自工程实践,对Rust的了解可能存在盲点,有些注解不够完善,还请读者指正,我会虚心接受改善,为初学者提供更好的入门教材。

目标

提供快速、准确、简单的入门方式,快速建立完整的Rust知识体系。

价值

基础知识,但并不代表他不重要,高级的功能都依赖与我们对基础知识的准确把握和深入理解。

学习一门计算机语言,我认为不是在编写过程中,有了问题去百度、google,最好的方式是在下手coding前,花时间把官网的教程学习一遍,以便减少犯低级错误。

官网的文档有如下的优点:

  1. 写这些文档的人都是大牛或者语言本身的创造者,他们对语言的特性的阐述和表达准确性是最高的。
  2. 文档经过多次的修改和完善,去除了错误的、过时的信息,避免误导读者。
  3. 知识体系完整,上下文知识关联,对于复杂的、需要静一步完善的知识,给出权威的参考链接。
  4. 讲解与代码相结合,完整的表达了作者意图,通过错误例子编译,展示出错信息,加强了读者对知识点的理解。

缺点:

  1. 文档大多数是英文,学习陡峭,初学者对语言的理解比较费脑。
  2. 初学者即使理解字面意思了,缺乏了解Rust领域专业知识。
  3. 学习挫败感强,效率低,容易放弃,或者三天打鱼,两天晒网,无法持续学习。

本注释版的价值:

  1. 简单、准确,完全参考官网材料1:1编写;
  2. 完整,全面覆盖Rust的重要特性和知识;
  3. 及时迭代更新,对错误的、过时的内容和新增的内容及时更新发布新版本;
  4. 初学者不需要搭建复杂的开发环境,可以直接在官网网页的playground上面运行,复杂的地方参考本书注释,通过代码和注解,快速掌握知识。
  5. 降低挫败感,持续学习,提升学习效率和体验。

Share this book

Categories

Author

About the Author

andy.hu

Contents

Table of Contents

  • 1. Hello World
  • 2. Primitives 原生类型
  • 3. Custom Types 自定义类型
    • 3.1 Structures 结构体
    • 3.2 Enums
    • 3.3 constants 常量
  • 4. Variable Bindings 变量绑定
    • 4.1 Mutability(可变性)
    • 4.2 Scope and Shadowning
    • 4.3 Declare first(先声明,后bingding)
    • 4.4 Freezing
  • 5. Types 类型
    • 5.1 Casting(转换)
    • 5.2 Literals(字面量)
    • 5.3 Inference(类型推导)
    • 5.4 Aliasing(别名)
  • 6. Conversion 转换
    • 6.1 From and Into
    • 6.2 TryFrom and TryInto
    • 6.3 To and from Strings
  • 7. Expressions 表达式
  • 8 Flow of Control 流程控制
    • 8.5 match
      • 8.5.1 解构
      • 8.5.2 Guards 守卫
      • 8.5.3 Binding
    • 8.6 if let
    • 8.6 while let
  • 9. Functions 函数
    • 9.1 方法
    • 9.2 闭包
  • 14. Generics 泛型
    • 14.1 函数
    • 14.2 实现
    • 14.3 Trait
    • 14.4 Bounds
    • 14.5 Multiple Bounds
    • 14.6 Where子句
    • 14.7 New Type Idiom
    • 14.8 Associated items(关联项)
    • 14.9 Phantom类型参数
  • 15. Scoping rules 作用域规则
    • 15.1 RAII
    • 15.2 所有权和转移
    • 15.3 借用
    • 15.4 Lifetimes(生命周期)
  • 16. Traits 特性
    • 16.1 Derive
    • 16.2 Returing Traits with dyn
    • 16.3 Operator Overloading(操作符重载)
    • 16.4 Drop trait
    • 16.5 Iterator(迭代器)
    • 16.6 impl trait
    • 16.7 Clone
    • 16.8 Supertraits
    • 16.9 Disambiguating overlapping traits

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub