We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 14d1df6 commit 42ad05aCopy full SHA for 42ad05a
posts/inside-rust/2022-11-17-async-fn-in-trait-nightly.md
@@ -50,7 +50,7 @@ Traits are the fundamental mechanism of abstraction in Rust. So what happens if
50
```rust
51
trait Database {
52
type FetchData<'a>: Future<Output = String> + 'a where Self: 'a;
53
- fn fetch_data(&self) -> FetchData<'a>;
+ fn fetch_data<'a>(&'a self) -> FetchData<'a>;
54
}
55
```
56
@@ -59,7 +59,7 @@ Notice that this associated type is generic. Generic associated types haven't be
59
60
impl Database for MyDb {
61
type FetchData<'a> = /* what type goes here??? */;
62
- fn fetch_data(&self) -> FetchData<'a> { async move { ... } }
+ fn fetch_data<'a>(&'a self) -> FetchData<'a> { async move { ... } }
63
64
65
0 commit comments