From 42ad05ab4a243d18844020d4ee94ecf297672322 Mon Sep 17 00:00:00 2001 From: lcnr Date: Thu, 24 Nov 2022 12:05:33 +0100 Subject: [PATCH] add missing explicit lifetime --- posts/inside-rust/2022-11-17-async-fn-in-trait-nightly.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/posts/inside-rust/2022-11-17-async-fn-in-trait-nightly.md b/posts/inside-rust/2022-11-17-async-fn-in-trait-nightly.md index 11fc07961..42a2ecd3a 100644 --- a/posts/inside-rust/2022-11-17-async-fn-in-trait-nightly.md +++ b/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 ```rust trait Database { type FetchData<'a>: Future + 'a where Self: 'a; - fn fetch_data(&self) -> FetchData<'a>; + fn fetch_data<'a>(&'a self) -> FetchData<'a>; } ``` @@ -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 { ... } } } ```