1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! `Send` assertion for HTTP client futures.
//!
//! On `wasm32-unknown-unknown`/`-none`, reqwest is backed by the JS `fetch`
//! API: its futures and response types hold JS values and are not `Send`,
//! while the query-execution futures that drive them are `Send`-bounded.
//! [`assert_send`] bridges that gap by wrapping the entire request/decode
//! block in a future that is manually declared `Send`. This is sound only
//! because those targets are single-threaded; If the build enables atomics
//! the future will no longer implement Send for
//!
//! On every other target — including `wasm32-wasip*`, where reqwest uses its
//! native, `Send` implementation — [`assert_send`] is the identity function
//! and merely asserts that the future already is `Send`.
use Future;
/// A future manually declared `Send` on single-threaded browser WASM.
;
// SAFETY: This implements Send for non-send futures only on the web wasm target which is
// single-threaded.
unsafe
/// Wraps `fut` so it is `Send` in wasm; see the module docs for why this is sound.