• Home
  • Raw
  • Download

Lines Matching refs:async

4 …ge/github-dtolnay/async--trait-8da0cb?style=for-the-badge&labelColor=555555&logo=github" height="2…
5 …img.shields.io/crates/v/async-trait.svg?style=for-the-badge&color=fc8d62&logo=rust" height="20">](…
6async--trait-66c2a5?style=for-the-badge&labelColor=555555&logoColor=white&logo=data:image/svg+xml;…
7 …/github/workflow/status/dtolnay/async-trait/CI/master?style=for-the-badge" height="20">](https://g…
9 The initial round of stabilizations for the async/await language feature in Rust
10 1.39 did not include support for async fn in traits. Trying to include an async
15 async fn f() {}
20 error[E0706]: trait fns cannot be declared `async`
23 4 | async fn f() {}
27 This crate provides an attribute macro to make async fn in traits work.
29 Please refer to [*why async fn in traits are hard*][hard] for a deeper analysis
33 [hard]: https://smallcultfollowing.com/babysteps/blog/2019/10/26/async-fn-in-traits-are-hard/
40 using async fn in a trait.
43 of traits and trait impls that contain async fn, and then they work.
50 async fn run(&self);
57 async fn run(&self) {
72 async fn run(&self) {
96 - 👍 Having async and non-async functions in the same trait;
106 'async_trait>>` and delegate to a private async freestanding function.
119 async fn run(_self: &AutoplayingVideo) {
132 Not all async traits need futures that are `dyn Future + Send`. To avoid having
133 Send and Sync bounds placed on the async trait methods, invoke the async trait
140 Be aware that async fn syntax does not allow lifetime elision outside of `&` and
152 async fn test(not_okay: Elided, okay: &usize) {}
160 9 | async fn test(not_okay: Elided, okay: &usize) {}
170 async fn test<'e>(elided: Elided<'e>) {}
172 async fn test(elided: Elided<'_>) {}
180 Traits with async methods can be used as trait objects as long as they meet the
187 async fn f(&self);
188 async fn g(&mut self);
197 The one wrinkle is in traits that provide default implementations of async
199 Send, the async\_trait macro must emit a bound of `Self: Sync` on trait methods
204 If you make a trait with async methods that have default implementations,
213 8 | async fn cannot_dyn(&self) {}
218 for some async methods, there are two resolutions. Either you can add Send
227 async fn can_dyn(&self) {}
239 async fn cannot_dyn(&self) where Self: Sized {}