mirror of
https://github.com/sunface/rust-by-practice.git
synced 2025-06-23 04:29:41 +00:00
Merge pull request #529 from Kibiandkimi/master
add editable to problem 4&6 in zh-CN/src/lifetime/advance.md
This commit is contained in:
@ -101,7 +101,7 @@ impl<'a> PartialEq<i32> for &'a T {
|
|||||||
这里只能使用更高级别的约束,因为引用的生命周期比函数上任何可能的生命周期参数都短。
|
这里只能使用更高级别的约束,因为引用的生命周期比函数上任何可能的生命周期参数都短。
|
||||||
|
|
||||||
4. 🌟🌟🌟
|
4. 🌟🌟🌟
|
||||||
```rust
|
```rust,editable
|
||||||
/* 添加 HRTB 使下面代码正常运行! */
|
/* 添加 HRTB 使下面代码正常运行! */
|
||||||
fn call_on_ref_zero<'a, F>(f: F) where F: Fn(&'a i32) {
|
fn call_on_ref_zero<'a, F>(f: F) where F: Fn(&'a i32) {
|
||||||
let zero = 0;
|
let zero = 0;
|
||||||
@ -237,7 +237,7 @@ struct Ref<'a, T> {
|
|||||||
## 艰难的练习
|
## 艰难的练习
|
||||||
|
|
||||||
6. 🌟🌟🌟🌟
|
6. 🌟🌟🌟🌟
|
||||||
```rust
|
```rust,editable
|
||||||
/* 使下面代码正常运行 */
|
/* 使下面代码正常运行 */
|
||||||
struct Interface<'a> {
|
struct Interface<'a> {
|
||||||
manager: &'a mut Manager<'a>
|
manager: &'a mut Manager<'a>
|
||||||
|
Reference in New Issue
Block a user