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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//! Minimal HTTP client for both native and WASM.
//!
//! Example:
//! ```
//! let request = ehttp::Request::get("https://www.example.com");
//! ehttp::fetch(request, move |result: ehttp::Result<ehttp::Response>| {
//! println!("Status code: {:?}", result.unwrap().status);
//! });
//! ```
//!
//! The given callback is called when the request is completed.
//! You can communicate the results back to the main thread using something like:
//!
//! * Channels (e.g. [`std::sync::mpsc::channel`](https://doc.rust-lang.org/std/sync/mpsc/fn.channel.html)).
//! * `Arc<Mutex<_>>`
//! * [`poll_promise::Promise`](https://docs.rs/poll-promise)
//! * [`eventuals::Eventual`](https://docs.rs/eventuals/latest/eventuals/struct.Eventual.html)
//! * [`tokio::sync::watch::channel`](https://docs.rs/tokio/latest/tokio/sync/watch/fn.channel.html)
//!
//! ## Feature flags
//!
/// Performs an HTTP request and calls the given callback when done.
///
/// `Ok` is returned if we get a response, even if it's a 404.
///
/// `Err` can happen for a number of reasons:
/// * No internet connection
/// * Connection timed out
/// * DNS resolution failed
/// * Firewall or proxy blocked the request
/// * Server is not reachable
/// * The URL is invalid
/// * Server's SSL cert is invalid
/// * CORS errors
/// * The initial GET which returned HTML contained CSP headers to block access to the resource
/// * A browser extension blocked the request (e.g. ad blocker)
/// * …
/// Performs an `async` HTTP request.
///
/// Available on following platforms:
/// - web
/// - native behind the `native-async` feature.
///
/// `Ok` is returned if we get a response, even if it's a 404.
///
/// `Err` can happen for a number of reasons:
/// * No internet connection
/// * Connection timed out
/// * DNS resolution failed
/// * Firewall or proxy blocked the request
/// * Server is not reachable
/// * The URL is invalid
/// * Server's SSL cert is invalid
/// * CORS errors
/// * The initial GET which returned HTML contained CSP headers to block access to the resource
/// * A browser extension blocked the request (e.g. ad blocker)
/// * …
pub async
pub use ;
pub use Mode;
pub use fetch_blocking;
pub use spawn_future;