pub trait HttpClient:
'static
+ Send
+ Sync {
// Required methods
fn type_name(&self) -> &'static str;
fn user_agent(&self) -> Option<&HeaderValue>;
fn send(
&self,
req: Request<AsyncBody>,
) -> Pin<Box<dyn Future<Output = Result<Response<AsyncBody>, Error>> + Send>>;
fn proxy(&self) -> Option<&Url>;
// Provided methods
fn get(
&self,
uri: &str,
body: AsyncBody,
follow_redirects: bool,
) -> Pin<Box<dyn Future<Output = Result<Response<AsyncBody>, Error>> + Send>> { ... }
fn post_json(
&self,
uri: &str,
body: AsyncBody,
) -> Pin<Box<dyn Future<Output = Result<Response<AsyncBody>, Error>> + Send>> { ... }
fn send_multipart_form<'a>(
&'a self,
_url: &str,
_request: Form,
) -> Pin<Box<dyn Future<Output = Result<Response<AsyncBody>, Error>> + Send + 'a>> { ... }
}Required Methods§
fn type_name(&self) -> &'static str
fn user_agent(&self) -> Option<&HeaderValue>
fn send( &self, req: Request<AsyncBody>, ) -> Pin<Box<dyn Future<Output = Result<Response<AsyncBody>, Error>> + Send>>
fn proxy(&self) -> Option<&Url>
Provided Methods§
fn get( &self, uri: &str, body: AsyncBody, follow_redirects: bool, ) -> Pin<Box<dyn Future<Output = Result<Response<AsyncBody>, Error>> + Send>>
fn post_json( &self, uri: &str, body: AsyncBody, ) -> Pin<Box<dyn Future<Output = Result<Response<AsyncBody>, Error>> + Send>>
fn send_multipart_form<'a>( &'a self, _url: &str, _request: Form, ) -> Pin<Box<dyn Future<Output = Result<Response<AsyncBody>, Error>> + Send + 'a>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".