File tree Expand file tree Collapse file tree 1 file changed +1
-22
lines changed
src/librustc_error_codes/error_codes Expand file tree Collapse file tree 1 file changed +1
-22
lines changed Original file line number Diff line number Diff line change @@ -42,28 +42,7 @@ impl MyDatabase {
4242
4343Until these issues are resolved, you can use the [ ` async-trait ` crate] , allowing you to use
4444` async fn ` in traits by desugaring to "boxed futures"
45- (` Pin<Box<dyn Future + Send + 'async>> ` ):
46-
47- ``` edition2018,ignore (example-of-desugaring-equivalence)
48- #[async_trait]
49- impl MyDatabase {
50- async fn get_user(&self) -> User {
51- unimplemented!()
52- }
53- }
54-
55- // The annotated impl above gets desugared as follows:
56- impl MyDatabase {
57- fn get_user<'async>(
58- &'async self,
59- ) -> Pin<Box<dyn std::future::Future<Output = User> + Send + 'async>>
60- where
61- Self: Sync + 'async,
62- {
63- unimplemented!()
64- }
65- }
66- ```
45+ (` Pin<Box<dyn Future + Send + 'async>> ` ).
6746
6847Note that using these trait methods will result in a heap allocation per-function-call. This is not
6948a significant cost for the vast majority of applications, but should be considered when deciding
You can’t perform that action at this time.
0 commit comments