Rust 编程语言极简教程 --- 实例学习

简介: Rust 编程语言极简教程 --- 实例学习安装$ curl https://sh.rustup.rs -sSf | shinfo: downloading installerWelcome to Rust!This will downl...

Rust 编程语言极简教程 --- 实例学习

安装

$ curl https://sh.rustup.rs -sSf | sh
info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust programming 
language, and its package manager, Cargo.
           
...

Rust 实例学习

https://rustbyexample.com/hello.html

Introduction

  1. Hello World
    1.1. Comments
    1.2. Formatted print
    1.2.1. Debug
    1.2.2. Display
    1.2.2.1. Testcase: List
    1.2.3. Formatting
  2. Primitives
    2.1. Literals and operators
    2.2. Tuples
    2.3. Arrays and Slices
  3. Custom Types
    3.1. Structures
    3.2. Enums
    3.2.1. use
    3.2.2. C-like
    3.2.3. Testcase: linked-list
    3.3. constants
  4. Variable Bindings
    4.1. Mutability
    4.2. Scope and Shadowing
    4.3. Declare first
  5. Types
    5.1. Casting
    5.2. Literals
    5.3. Inference
    5.4. Aliasing
  6. Conversion
    6.1. From and Into
    6.2. To and From String
  7. Expressions
  8. Flow Control
    8.1. if/else
    8.2. loop
    8.2.1. Nesting and labels
    8.2.2. Returning from loops
    8.3. while
    8.4. for and range
    8.5. match
    8.5.1. Destructuring
    8.5.1.1. tuples
    8.5.1.2. enums
    8.5.1.3. pointers/ref
    8.5.1.4. structs
    8.5.2. Guards
    8.5.3. Binding
    8.6. if let
    8.7. while let
  9. Functions
    9.1. Methods
    9.2. Closures
    9.2.1. Capturing
    9.2.2. As input parameters
    9.2.3. Type anonymity
    9.2.4. Input functions
    9.2.5. As output parameters
    9.2.6. Examples in std
    9.2.6.1. Iterator::any
    9.2.6.2. Iterator::find
    9.3. Higher Order Functions
  10. Modules
    10.1. Visibility
    10.2. Struct visibility
    10.3. The use declaration
    10.4. super and self
    10.5. File hierarchy
  11. Crates
    11.1. Library
    11.2. extern crate
  12. Attributes
    12.1. dead_code
    12.2. Crates
    12.3. cfg
    12.3.1. Custom
  13. Generics
    13.1. Functions
    13.2. Implementation
    13.3. Traits
    13.4. Bounds
    13.4.1. Testcase: empty bounds
    13.5. Multiple bounds
    13.6. Where clauses
    13.7. New Type Idiom
    13.8. Associated items
    13.8.1. The Problem
    13.8.2. Associated types
    13.9. Phantom type parameters
    13.9.1. Testcase: unit clarification
  14. Scoping rules
    14.1. RAII
    14.2. Ownership and moves
    14.2.1. Mutability
    14.3. Borrowing
    14.3.1. Mutability
    14.3.2. Freezing
    14.3.3. Aliasing
    14.3.4. The ref pattern
    14.4. Lifetimes
    14.4.1. Explicit annotation
    14.4.2. Functions
    14.4.3. Methods
    14.4.4. Structs
    14.4.5. Bounds
    14.4.6. Coercion
    14.4.7. static
    14.4.8. elision
  15. Traits
    15.1. Derive
    15.2. Operator Overloading
    15.3. Drop
    15.4. Iterators
    15.5. Clone
  16. macro_rules!
    16.1. Syntax
    16.1.1. Designators
    16.1.2. Overload
    16.1.3. Repeat
    16.2. DRY (Don't Repeat Yourself)
    16.3. DSL (Domain Specific Languages)
    16.4. Variadics
  17. Error handling
    17.1. panic
    17.2. Option & unwrap
    17.2.1. Combinators: map
    17.2.2. Combinators: and_then
    17.3. Result
    17.3.1. map for Result
    17.3.2. aliases for Result
    17.3.3. Early returns
    17.3.4. Introducing ?
    17.4. Multiple error types
    17.4.1. Pulling Results out of Options
    17.4.2. Defining an error type
    17.4.3. Boxing errors
    17.4.4. Other uses of ?
    17.4.5. Wrapping errors
    17.5. Iterating over Results
  18. Std library types
    18.1. Box, stack and heap
    18.2. Vectors
    18.3. Strings
    18.4. Option
    18.5. Result
    18.5.1. ?
    18.6. panic!
    18.7. HashMap
    18.7.1. Alternate/custom key types
    18.7.2. HashSet
  19. Std misc
    19.1. Threads
    19.1.1. Testcase: map-reduce
    19.2. Channels
    19.3. Path
    19.4. File I/O
    19.4.1. open
    19.4.2. create
    19.5. Child processes
    19.5.1. Pipes
    19.5.2. Wait
    19.6. Filesystem Operations
    19.7. Program arguments
    19.7.1. Argument parsing
    19.8. Foreign Function Interface
  20. Meta
    20.1. Documentation
    20.2. Testing
  21. Unsafe Operations
相关文章
|
12天前
|
Rust 安全 开发者
探索新一代编程语言:Rust
【4月更文挑战第28天】
|
3月前
|
JSON Rust IDE
全网最全的Rust学习资源
学习Rust过程中整理了一些学习资料分享一下。
109 1
|
4月前
|
Rust
Rust编程语言:探索性学习与实践指南
Rust编程语言:探索性学习与实践指南
35 0
|
4月前
|
Rust 编译器
【一起学Rust】Rust学习前准备——注释和格式化输出
【一起学Rust】Rust学习前准备——注释和格式化输出
37 0
|
5月前
|
Rust
Rust编程语言:探索性学习与实践指南
Rust编程语言:探索性学习与实践指南
31 0
|
5月前
|
Rust 前端开发 安全
致所有渴望学习Rust的人的信
致所有渴望学习Rust的人的信
|
6月前
|
Rust 安全 JavaScript
Rust教程初识
当然,它们都有编译然后执行可执行程序的用法。应当有编译后改名的方式,不然那也太不coooooooooooool了。
45 0
|
10月前
|
存储 消息中间件 Rust
Rust极简教程
Rust是一门赋予每个人构建可靠且高效软件能力的编程语言。可靠主要体现在安全性上。其高效不仅限于开发效率,它的执行效率也是令人称赞的,是一种少有的兼顾开发效率和执行效率的语言。Rust 语言由 Mozilla 开发,最早发布于 2014 年 9 月。Rust 的编译器是在 MIT License 和 Apache License 2.0 双重协议声明下的免费开源软件。
247 0
Rust极简教程
|
Rust C语言 Windows
|
Rust 编译器
Rust 中级教程 第17课——引用的 lifetime(2)
Rust 中级教程 第17课——引用的 lifetime(2)
Rust 中级教程 第17课——引用的 lifetime(2)