File tree 2 files changed +6
-10
lines changed
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.
118
118
## Explanation
119
119
120
120
Async 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 .
122
122
123
123
For example the ` impl Advertisement for AutoplayingVideo ` above would be
124
124
expanded as:
@@ -131,11 +131,9 @@ impl Advertisement for AutoplayingVideo {
131
131
where
132
132
Self : Sync + 'async_trait ,
133
133
{
134
- async fn run ( _self : & AutoplayingVideo ) {
134
+ Box :: pin ( async move {
135
135
/* the original method body */
136
- }
137
-
138
- Box :: pin (run (self ))
136
+ })
139
137
}
140
138
}
141
139
```
Original file line number Diff line number Diff line change 133
133
//! # Explanation
134
134
//!
135
135
//! 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 .
137
137
//!
138
138
//! For example the `impl Advertisement for AutoplayingVideo` above would be
139
139
//! expanded as:
147
147
//! where
148
148
//! Self: Sync + 'async_trait,
149
149
//! {
150
- //! async fn run(_self: &AutoplayingVideo) {
150
+ //! Box::pin( async move {
151
151
//! /* the original method body */
152
- //! }
153
- //!
154
- //! Box::pin(run(self))
152
+ //! })
155
153
//! }
156
154
//! }
157
155
//! # };
You can’t perform that action at this time.
0 commit comments