pub trait HttpClient:
'static
+ Send
+ Sync {
// Required methods
fn user_agent(&self) -> Option<&HeaderValue>;
fn proxy(&self) -> Option<&Url>;
fn send(
&self,
req: Request<AsyncBody>,
) -> Pin<Box<dyn Future<Output = Result<Response<AsyncBody>, Error>> + Send>>;
// 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>> { ... }
}Required Methods§
fn user_agent(&self) -> Option<&HeaderValue>
fn proxy(&self) -> Option<&Url>
fn send( &self, req: Request<AsyncBody>, ) -> Pin<Box<dyn Future<Output = Result<Response<AsyncBody>, Error>> + Send>>
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>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".