File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ can't be that badly broken.
118118## Explanation
119119
120120Async fns get transformed into methods that return `Pin<Box<dyn Future + Send +
121- 'async_trait>>` and delegate to a private async freestanding function .
121+ 'async_trait>>` and delegate to an async block .
122122
123123For example the ` impl Advertisement for AutoplayingVideo ` above would be
124124expanded as:
@@ -131,11 +131,9 @@ impl Advertisement for AutoplayingVideo {
131131 where
132132 Self : Sync + 'async_trait ,
133133 {
134- async fn run ( _self : & AutoplayingVideo ) {
134+ Box :: pin ( async move {
135135 /* the original method body */
136- }
137-
138- Box :: pin (run (self ))
136+ })
139137 }
140138}
141139```
Original file line number Diff line number Diff line change 133133//! # Explanation
134134//!
135135//! Async fns get transformed into methods that return `Pin<Box<dyn Future +
136- //! Send + 'async_trait>>` and delegate to a private async freestanding function .
136+ //! Send + 'async_trait>>` and delegate to an async block .
137137//!
138138//! For example the `impl Advertisement for AutoplayingVideo` above would be
139139//! expanded as:
147147//! where
148148//! Self: Sync + 'async_trait,
149149//! {
150- //! async fn run(_self: &AutoplayingVideo) {
150+ //! Box::pin( async move {
151151//! /* the original method body */
152- //! }
153- //!
154- //! Box::pin(run(self))
152+ //! })
155153//! }
156154//! }
157155//! # };
You can’t perform that action at this time.
0 commit comments