fix: typo in ok-stack

pull/869/head
zongzi531 3 years ago
parent c68975f1ce
commit 68344de357

@ -217,7 +217,7 @@ impl<'a, T> Iterator for Iter<'a, T> {
现在,我们也许可以自信的编译下试试了: 现在,我们也许可以自信的编译下试试了:
```shell ```shell
cargo build > cargo build
error[E0308]: mismatched types error[E0308]: mismatched types
--> src/second.rs:77:22 --> src/second.rs:77:22
@ -260,7 +260,8 @@ impl<'a, T> Iterator for Iter<'a, T> {
``` ```
```shell ```shell
cargo build > cargo build
Compiling lists v0.1.0 (/Users/ABeingessner/dev/temp/lists) Compiling lists v0.1.0 (/Users/ABeingessner/dev/temp/lists)
error[E0515]: cannot return reference to local data `*node` error[E0515]: cannot return reference to local data `*node`
--> src/second.rs:77:43 --> src/second.rs:77:43
@ -314,7 +315,8 @@ impl<'a, T> Iterator for Iter<'a, T> {
``` ```
```shell ```shell
cargo build > cargo build
Compiling lists v0.1.0 (/Users/ABeingessner/dev/temp/lists) Compiling lists v0.1.0 (/Users/ABeingessner/dev/temp/lists)
error[E0308]: mismatched types error[E0308]: mismatched types
--> src/second.rs:77:22 --> src/second.rs:77:22
@ -362,7 +364,7 @@ impl<'a, T> Iterator for Iter<'a, T> {
``` ```
```shell ```shell
cargo build > cargo build
``` ```
🎉 🎉 🎉 🎉 🎉 🎉

@ -58,6 +58,7 @@ impl<'a, T> Iterator for IterMut<'a, T> {
```shell ```shell
> cargo build > cargo build
error[E0596]: cannot borrow `self.head` as mutable, as it is behind a `&` reference error[E0596]: cannot borrow `self.head` as mutable, as it is behind a `&` reference
--> src/second.rs:95:25 --> src/second.rs:95:25
| |

@ -46,7 +46,7 @@ pub fn peek(&self) -> Option<&T> {
``` ```
```shell ```shell
cargo build > cargo build
Finished dev [unoptimized + debuginfo] target(s) in 0.32s Finished dev [unoptimized + debuginfo] target(s) in 0.32s
``` ```
@ -124,7 +124,7 @@ fn peek() {
这次我们直接匹配出来可变引用 `value`,然后对其修改即可。 这次我们直接匹配出来可变引用 `value`,然后对其修改即可。
```shell ```shell
cargo test > cargo test
Running target/debug/lists-5c71138492ad4b4a Running target/debug/lists-5c71138492ad4b4a

@ -137,7 +137,7 @@ test second::test::basics ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured
``` ```
很棒,接下来让我们来解决目前链表最大的问题:只支持 i32 类型的元素值。 很棒,接下来让我们来解决目前链表最大的问题:只支持 `i32` 类型的元素值。
## 泛型 ## 泛型
为了让链表支持任何类型的元素,泛型就是绕不过去的坎,首先将所有的类型定义修改为泛型实现: 为了让链表支持任何类型的元素,泛型就是绕不过去的坎,首先将所有的类型定义修改为泛型实现:

Loading…
Cancel
Save