pub trait Transport:
Send
+ Sync
+ Debug
+ Clone {
// Required methods
fn with_proxy(
&mut self,
proxy: Url,
host_matcher: Option<&str>,
accept_invalid_certs: bool,
) -> Result<(), HttpError>;
fn http_get<'life0, 'async_trait, R>(
&'life0 self,
url: Url,
auth: Option<AuthToken>,
) -> Pin<Box<dyn Future<Output = Result<R, HttpError>> + Send + 'async_trait>>
where R: DeserializeOwned + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait;
fn http_get_raw<'life0, 'async_trait>(
&'life0 self,
url: Url,
auth: Option<AuthToken>,
) -> Pin<Box<dyn Future<Output = Result<RawResponse, HttpError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn http_post<'life0, 'life1, 'async_trait, P, R>(
&'life0 self,
url: Url,
auth_token: Option<AuthToken>,
payload: &'life1 P,
) -> Pin<Box<dyn Future<Output = Result<R, HttpError>> + Send + 'async_trait>>
where P: Serialize + Send + Sync + 'async_trait,
R: DeserializeOwned + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn http_post_form_raw<'life0, 'life1, 'async_trait, P>(
&'life0 self,
url: Url,
auth_token: Option<AuthToken>,
payload: &'life1 P,
) -> Pin<Box<dyn Future<Output = Result<RawResponse, HttpError>> + Send + 'async_trait>>
where P: Serialize + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn ws_connect<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
url: &'life1 str,
headers: &'life2 [(&'life3 str, &'life4 str)],
) -> Pin<Box<dyn Future<Output = Result<(WsSender, WsReceiver), WsError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait { ... }
fn resolve_dns_txt<'life0, 'life1, 'async_trait>(
&'life0 self,
_domain: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, HttpError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Expected HTTP transport.
Callers that construct a transport implicitly may add a Default bound,
while configured transports can be supplied directly without implementing
a meaningless default configuration.
Required Methods§
Sourcefn with_proxy(
&mut self,
proxy: Url,
host_matcher: Option<&str>,
accept_invalid_certs: bool,
) -> Result<(), HttpError>
fn with_proxy( &mut self, proxy: Url, host_matcher: Option<&str>, accept_invalid_certs: bool, ) -> Result<(), HttpError>
Make the transport use a proxy.
SOCKS proxy schemes such as socks5h are available only when this crate
is built with the reqwest feature. The default bitreq backend accepts
HTTP proxy URLs only.
Sourcefn http_get<'life0, 'async_trait, R>(
&'life0 self,
url: Url,
auth: Option<AuthToken>,
) -> Pin<Box<dyn Future<Output = Result<R, HttpError>> + Send + 'async_trait>>where
R: DeserializeOwned + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn http_get<'life0, 'async_trait, R>(
&'life0 self,
url: Url,
auth: Option<AuthToken>,
) -> Pin<Box<dyn Future<Output = Result<R, HttpError>> + Send + 'async_trait>>where
R: DeserializeOwned + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
HTTP GET request.
Sourcefn http_get_raw<'life0, 'async_trait>(
&'life0 self,
url: Url,
auth: Option<AuthToken>,
) -> Pin<Box<dyn Future<Output = Result<RawResponse, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn http_get_raw<'life0, 'async_trait>(
&'life0 self,
url: Url,
auth: Option<AuthToken>,
) -> Pin<Box<dyn Future<Output = Result<RawResponse, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
HTTP GET request returning a raw response.
Sourcefn http_post<'life0, 'life1, 'async_trait, P, R>(
&'life0 self,
url: Url,
auth_token: Option<AuthToken>,
payload: &'life1 P,
) -> Pin<Box<dyn Future<Output = Result<R, HttpError>> + Send + 'async_trait>>where
P: Serialize + Send + Sync + 'async_trait,
R: DeserializeOwned + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn http_post<'life0, 'life1, 'async_trait, P, R>(
&'life0 self,
url: Url,
auth_token: Option<AuthToken>,
payload: &'life1 P,
) -> Pin<Box<dyn Future<Output = Result<R, HttpError>> + Send + 'async_trait>>where
P: Serialize + Send + Sync + 'async_trait,
R: DeserializeOwned + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
HTTP POST request.
Provided Methods§
Sourcefn ws_connect<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
url: &'life1 str,
headers: &'life2 [(&'life3 str, &'life4 str)],
) -> Pin<Box<dyn Future<Output = Result<(WsSender, WsReceiver), WsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn ws_connect<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
url: &'life1 str,
headers: &'life2 [(&'life3 str, &'life4 str)],
) -> Pin<Box<dyn Future<Output = Result<(WsSender, WsReceiver), WsError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Connect to a WebSocket endpoint using this transport.
Sourcefn resolve_dns_txt<'life0, 'life1, 'async_trait>(
&'life0 self,
_domain: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn resolve_dns_txt<'life0, 'life1, 'async_trait>(
&'life0 self,
_domain: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, HttpError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
DNS resolver to get TXT records from a domain name.
Transports that support DNS resolution should override this method. The
default implementation keeps the trait API stable when the bip353
feature is disabled.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".