pub struct ReqwestClient { /* private fields */ }Expand description
Production HTTP client using reqwest.
This is a thin wrapper around reqwest::Client that implements
the HttpClient trait. It inherits reqwest’s default configuration
including connection pooling and reasonable timeouts.
§Example
use ddns_a::webhook::{ReqwestClient, HttpClient, HttpRequest};
use url::Url;
let client = ReqwestClient::new();
let url = Url::parse("https://api.example.com/webhook")?;
let request = HttpRequest::post(url).with_body(b"hello".to_vec());
let response = client.request(request).await?;
println!("Status: {}", response.status);Implementations§
Source§impl ReqwestClient
impl ReqwestClient
Sourcepub const fn from_client(client: Client) -> Self
pub const fn from_client(client: Client) -> Self
Creates an HTTP client from an existing reqwest client.
Useful when you need custom configuration (timeouts, TLS, etc.).
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 Default for ReqwestClient
impl Default for ReqwestClient
Source§impl HttpClient for ReqwestClient
impl HttpClient for ReqwestClient
Source§async fn request(&self, req: HttpRequest) -> Result<HttpResponse, HttpError>
async fn request(&self, req: HttpRequest) -> Result<HttpResponse, HttpError>
Sends an HTTP request and returns the response. Read more
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