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
use crate::{ClientOptions, Transport, TransportFactory};
use std::sync::Arc;
#[cfg(feature = "httpdate")]
mod ratelimit;
#[cfg(any(feature = "curl", feature = "ureq"))]
mod thread;
#[cfg(any(feature = "reqwest", feature = "surf",))]
mod tokio_thread;
#[cfg(feature = "reqwest")]
mod reqwest;
#[cfg(feature = "reqwest")]
pub use reqwest::ReqwestHttpTransport;
#[cfg(feature = "curl")]
mod curl;
#[cfg(feature = "curl")]
pub use curl::CurlHttpTransport;
#[cfg(feature = "surf")]
mod surf;
#[cfg(feature = "surf")]
pub use surf::SurfHttpTransport;
#[cfg(feature = "ureq")]
mod ureq;
#[cfg(feature = "ureq")]
pub use ureq::UreqHttpTransport;
#[cfg(feature = "reqwest")]
type DefaultTransport = ReqwestHttpTransport;
#[cfg(all(
feature = "curl",
not(feature = "reqwest"),
not(feature = "surf"),
not(feature = "ureq")
))]
type DefaultTransport = CurlHttpTransport;
#[cfg(all(
feature = "surf",
not(feature = "reqwest"),
not(feature = "curl"),
not(feature = "ureq")
))]
type DefaultTransport = SurfHttpTransport;
#[cfg(all(
feature = "ureq",
not(feature = "reqwest"),
not(feature = "curl"),
not(feature = "surf")
))]
type DefaultTransport = UreqHttpTransport;
#[cfg(any(
feature = "reqwest",
feature = "curl",
feature = "surf",
feature = "ureq"
))]
pub type HttpTransport = DefaultTransport;
#[derive(Clone)]
pub struct DefaultTransportFactory;
impl TransportFactory for DefaultTransportFactory {
fn create_transport(&self, options: &ClientOptions) -> Arc<dyn Transport> {
#[cfg(any(
feature = "reqwest",
feature = "curl",
feature = "surf",
feature = "ureq"
))]
{
Arc::new(HttpTransport::new(options))
}
#[cfg(not(any(
feature = "reqwest",
feature = "curl",
feature = "surf",
feature = "ureq"
)))]
{
let _ = options;
panic!("sentry crate was compiled without transport")
}
}
}