@@ -80,7 +80,7 @@ blocking code except for async/await keywords. And use feature gate
80
80
maybe_async = { version = " 0.2" , features = [" is_sync" ] }
81
81
```
82
82
83
- There are three usage variants for `maybe_async` attribute macros :
83
+ There are three usage variants for `maybe_async` attribute usage :
84
84
- `#[maybe_async]` or `#[maybe_async(Send)]`
85
85
86
86
In this mode, `#[async_trait::async_trait]` is added to trait declarations and trait implementations
@@ -97,11 +97,14 @@ blocking code except for async/await keywords. And use feature gate
97
97
98
98
AFIT is acronym for **a**sync **f**unction **i**n **t**rait, stabilized from rust 1.74
99
99
100
+ For compatibility reasons, the `async fn` in traits is supported via a verbose `AFIT` flag. This will become
101
+ the default mode for the next major release.
102
+
100
103
- `must_be_async`
101
104
102
105
**Keep async**.
103
106
104
- There are three usage variants for `must_be_async` attribute macros :
107
+ There are three usage variants for `must_be_async` attribute usage :
105
108
- `#[must_be_async]` or `#[must_be_async(Send)]`
106
109
- `#[must_be_async(?Send)]`
107
110
- `#[must_be_async(AFIT)]`
@@ -130,7 +133,7 @@ blocking code except for async/await keywords. And use feature gate
130
133
An async implementation should on compile on async implementation and
131
134
must simply disappear when we want sync version.
132
135
133
- There are three usage variants for `async_impl` attribute macros :
136
+ There are three usage variants for `async_impl` attribute usage :
134
137
- `#[async_impl]` or `#[async_impl(Send)]`
135
138
- `#[async_impl(?Send)]`
136
139
- `#[async_impl(AFIT)]`
@@ -179,7 +182,7 @@ Here is a detailed example on what's going on whe the `is_sync` feature
179
182
gate set or not.
180
183
181
184
```rust
182
- # [maybe_async::maybe_async(?Send )]
185
+ # [maybe_async::maybe_async(AFIT )]
183
186
trait A {
184
187
async fn async_fn_name() -> Result<(), ()> {
185
188
Ok(())
@@ -191,7 +194,7 @@ trait A {
191
194
192
195
struct Foo;
193
196
194
- # [maybe_async::maybe_async(?Send )]
197
+ # [maybe_async::maybe_async(AFIT )]
195
198
impl A for Foo {
196
199
async fn async_fn_name() -> Result<(), ()> {
197
200
Ok(())
@@ -215,7 +218,6 @@ is async code:
215
218
216
219
``` rust
217
220
// Compiled code when `is_sync` is toggled off.
218
- #[async_trait:: async_trait(? Send )]
219
221
trait A {
220
222
async fn maybe_async_fn_name () -> Result <(), ()> {
221
223
Ok (())
@@ -227,7 +229,6 @@ trait A {
227
229
228
230
struct Foo ;
229
231
230
- #[async_trait:: async_trait(? Send )]
231
232
impl A for Foo {
232
233
async fn maybe_async_fn_name () -> Result <(), ()> {
233
234
Ok (())
0 commit comments