Skip to content

Commit 565a5ad

Browse files
committed
Document ?Send
1 parent 63e386d commit 565a5ad

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ impl Advertisement for AutoplayingVideo {
127127

128128
<br>
129129

130+
## Non-threadsafe futures
131+
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
134+
macro as `#[async_trait(?Send)]` on both the trait and the impl blocks.
135+
136+
<br>
137+
130138
## Elided lifetimes
131139

132140
Be aware that async fn syntax does not allow lifetime elision outside of `&` and

src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,15 @@
137137
//!
138138
//! <br><br>
139139
//!
140+
//! # Non-threadsafe futures
141+
//!
142+
//! Not all async traits need futures that are `dyn Future + Send`. To avoid
143+
//! having Send and Sync bounds placed on the async trait methods, invoke the
144+
//! async trait macro as `#[async_trait(?Send)]` on both the trait and the impl
145+
//! blocks.
146+
//!
147+
//! <br>
148+
//!
140149
//! # Elided lifetimes
141150
//!
142151
//! Be aware that async fn syntax does not allow lifetime elision outside of `&`

0 commit comments

Comments
 (0)