Skip to content

add missing explicit lifetime #1050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions posts/inside-rust/2022-11-17-async-fn-in-trait-nightly.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Traits are the fundamental mechanism of abstraction in Rust. So what happens if
```rust
trait Database {
type FetchData<'a>: Future<Output = String> + 'a where Self: 'a;
fn fetch_data(&self) -> FetchData<'a>;
fn fetch_data<'a>(&'a self) -> FetchData<'a>;
}
```

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

Expand Down