Skip to content

Commit 502eb60

Browse files
author
WaySLOG
committed
Merge pull request #133 from nextzhou/master
修正笔误
2 parents 7bdce98 + 83c62af commit 502eb60

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

14-collections/14-01-vec.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ let a = vec![1, 2, 3];
6464
assert_eq!(a[1usize], 2);
6565
```
6666

67-
那么,Rust中有没有安全的下标访问机制呢?答案是当然有:—— `.get(n: usize)``.get_mut(n)`) 函数。
68-
对于一个数组,这个函数返回一个Option<&T>,当Option==None的时候,即下标越界,其他情况下,我们能安全的获得一个Vec里面元素的引用。
67+
那么,Rust中有没有安全的下标访问机制呢?答案是当然有:—— `.get(n: usize)``.get_mut(n: usize)`) 函数。
68+
对于一个数组,这个函数返回一个`Option<&T>` (`Option<&mut T>`),当Option==None的时候,即下标越界,其他情况下,我们能安全的获得一个Vec里面元素的引用。
6969

7070
```
7171
let v =vec![1, 2, 3];

21-intoborrow/21-01-into.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## From<T>
88

9-
对于类型为 `U` 的对象 `foo`,如果它实现了 `From<T>`,那么,可以通过 `let foo = U::from<bar>` 来生成自己。这里,`bar` 是类型为 `T` 的对象。
9+
对于类型为 `U` 的对象 `foo`,如果它实现了 `From<T>`,那么,可以通过 `let foo = U::from(bar)` 来生成自己。这里,`bar` 是类型为 `T` 的对象。
1010

1111
下面举一例,因为 `String` 实现了 `From<&str>`,所以 `String` 可以从 `&str` 生成。
1212

30-coding-style/30-01-style.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ let diameter = 7;
173173

174174
### 解释上下文
175175

176-
Rust 没有特定的构造器,只是返回新实例的韩式
176+
Rust 没有特定的构造器,只有返回新实例的函数
177177
这些在自动生成的类型文档中是不可见的,因此你应该专门链接到它们:
178178

179179
``` rust

0 commit comments

Comments
 (0)