Skip to content

Commit 42ad05a

Browse files
authored
add missing explicit lifetime
1 parent 14d1df6 commit 42ad05a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

posts/inside-rust/2022-11-17-async-fn-in-trait-nightly.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Traits are the fundamental mechanism of abstraction in Rust. So what happens if
5050
```rust
5151
trait Database {
5252
type FetchData<'a>: Future<Output = String> + 'a where Self: 'a;
53-
fn fetch_data(&self) -> FetchData<'a>;
53+
fn fetch_data<'a>(&'a self) -> FetchData<'a>;
5454
}
5555
```
5656

@@ -59,7 +59,7 @@ Notice that this associated type is generic. Generic associated types haven't be
5959
```rust
6060
impl Database for MyDb {
6161
type FetchData<'a> = /* what type goes here??? */;
62-
fn fetch_data(&self) -> FetchData<'a> { async move { ... } }
62+
fn fetch_data<'a>(&'a self) -> FetchData<'a> { async move { ... } }
6363
}
6464
```
6565

0 commit comments

Comments
 (0)