Update basic.md

change 标准 to 标注
This commit is contained in:
Illus1on
2024-10-08 13:27:13 +08:00
committed by GitHub
parent 8e0def5f08
commit 796a989e13

View File

@ -77,7 +77,7 @@ fn print_one<'a>(x: &'a i32) {
println!("`print_one`: x is {}", x); println!("`print_one`: x is {}", x);
} }
// 可变引用依然需要标生命周期 // 可变引用依然需要标生命周期
fn add_one<'a>(x: &'a mut i32) { fn add_one<'a>(x: &'a mut i32) {
*x += 1; *x += 1;
} }
@ -163,7 +163,7 @@ fn main() {
#### Structs #### Structs
6. 🌟 6. 🌟
```rust,editable ```rust,editable
/* 增加合适的生命周期标,让代码工作 */ /* 增加合适的生命周期标,让代码工作 */
// `i32` 的引用必须比 `Borrowed` 活得更久 // `i32` 的引用必须比 `Borrowed` 活得更久
#[derive(Debug)] #[derive(Debug)]