pub struct ReqwestClient { /* private fields */ }Expand description
Async HTTP backend powered by reqwest.
This is the default backend, enabled by the reqwest-client feature flag.
It requires an async runtime (typically Tokio).
§Construction
Usually you don’t need to construct this directly — Mesa::new
and ClientBuilder::build create it for you.
If you need a custom reqwest::Client (e.g., with a proxy or custom TLS):
use mesa_dev::{ClientBuilder, ReqwestClient};
let reqwest_client = reqwest::Client::builder()
.danger_accept_invalid_certs(true) // for development only!
.build()
.unwrap();
let client = ClientBuilder::new("my-api-key")
.build_with(ReqwestClient::from_client(reqwest_client));Implementations§
Source§impl ReqwestClient
impl ReqwestClient
Sourcepub fn from_client(client: Client) -> Self
pub fn from_client(client: Client) -> Self
Create a ReqwestClient from an existing reqwest::Client.
Trait Implementations§
Source§impl Clone for ReqwestClient
impl Clone for ReqwestClient
Source§fn clone(&self) -> ReqwestClient
fn clone(&self) -> ReqwestClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReqwestClient
impl Debug for ReqwestClient
Source§impl HttpClient for ReqwestClient
impl HttpClient for ReqwestClient
Source§async fn send(
&self,
request: HttpRequest,
) -> Result<HttpResponse, HttpClientError>
async fn send( &self, request: HttpRequest, ) -> Result<HttpResponse, HttpClientError>
Send an HTTP request and return the response.
Auto Trait Implementations§
impl Freeze for ReqwestClient
impl !RefUnwindSafe for ReqwestClient
impl Send for ReqwestClient
impl Sync for ReqwestClient
impl Unpin for ReqwestClient
impl !UnwindSafe for ReqwestClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more