Merge pull request #880 from qwer252/main

Update main.rs
main
KaiserY 2 days ago committed by GitHub
commit 8b0149755f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -3,7 +3,7 @@ fn main() {
{ {
let v = vec![1, 2, 3, 4]; let v = vec![1, 2, 3, 4];
// do stuff with v // 使用 v
} // <- v goes out of scope and is freed here } // <- 在这里 v 离开作用域并被释放
// ANCHOR_END: here // ANCHOR_END: here
} }

@ -77,7 +77,7 @@
如果 `push_str` 方法获取了 `s2` 的所有权,就不能在最后一行打印出其值了。好在代码如我们期望那样工作! 如果 `push_str` 方法获取了 `s2` 的所有权,就不能在最后一行打印出其值了。好在代码如我们期望那样工作!
`push` 方法被定义为获取一个单独的字符作为参数,并附加到 `String` 中。示例 8-17 展示了使用 `push` 方法将字母 *l* 加入 `String` 的代码。 `push` 方法被定义为获取一个单独的字符作为参数,并附加到 `String` 中。示例 8-17 展示了使用 `push` 方法将字母 `l` 加入 `String` 的代码。
```rust ```rust
{{#rustdoc_include ../listings/ch08-common-collections/listing-08-17/src/main.rs:here}} {{#rustdoc_include ../listings/ch08-common-collections/listing-08-17/src/main.rs:here}}

Loading…
Cancel
Save