From 273aa2d423b974c1fd5b35c7131b747b900a7df3 Mon Sep 17 00:00:00 2001 From: Harry van Haaren Date: Mon, 12 Dec 2022 22:32:12 +0000 Subject: [PATCH] 07 workarounds/async in trait: update that nightly has mvp Signed-off-by: Harry van Haaren --- src/07_workarounds/05_async_in_traits.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/07_workarounds/05_async_in_traits.md b/src/07_workarounds/05_async_in_traits.md index 7241ac3..d2c273e 100644 --- a/src/07_workarounds/05_async_in_traits.md +++ b/src/07_workarounds/05_async_in_traits.md @@ -1,10 +1,10 @@ # `async` in Traits -Currently, `async fn` cannot be used in traits. The reasons for this are -somewhat complex, but there are plans to remove this restriction in the -future. +Currently, `async fn` cannot be used in traits on the stable release of Rust. +Since the 17th November 2022, an MVP of async-fn-in-trait is available on the nightly +version of the compiler tool chain, [see here for details](https://blog.rust-lang.org/inside-rust/2022/11/17/async-fn-in-trait-nightly.html). -In the meantime, however, this can be worked around using the +In the meantime, there is a work around for the stable tool chain using the [async-trait crate from crates.io](https://github.com/dtolnay/async-trait). Note that using these trait methods will result in a heap allocation