pub struct ReqwestClient { /* private fields */ }Expand description
A client for executing requests as defined by http_request_derive::HttpRequest implementations.
Implementations§
Source§impl ReqwestClient
impl ReqwestClient
Sourcepub fn new(base_url: Url) -> Self
pub fn new(base_url: Url) -> Self
Create a new ReqwestClient from a base Url.
Sourcepub fn logger(&self) -> Option<HttpLogger>
pub fn logger(&self) -> Option<HttpLogger>
Get the logger for dumping information about the HTTP communication if it is set.
Sourcepub fn set_logger(&mut self, logger: HttpLogger)
pub fn set_logger(&mut self, logger: HttpLogger)
Set a logger for dumping information about the HTTP communication.
Sourcepub fn with_logger(self, logger: HttpLogger) -> Self
pub fn with_logger(self, logger: HttpLogger) -> Self
Return the client with a new logger for dumping the HTTP communication.
Sourcepub fn set_base_url(&mut self, base_url: Url)
pub fn set_base_url(&mut self, base_url: Url)
Sets the base URL to the given URL.
Sourcepub fn with_base_url(self, base_url: Url) -> Self
pub fn with_base_url(self, base_url: Url) -> Self
Return the client with a new base URL.
Trait Implementations§
Source§impl Client for ReqwestClient
impl Client for ReqwestClient
Source§type ClientError = ReqwestClientError
type ClientError = ReqwestClientError
An error that can be returned during request execution by the
Client.Source§fn execute<'life0, 'async_trait, R>(
&'life0 self,
request: R,
) -> Pin<Box<dyn Future<Output = Result<R::Response, Self::ClientError>> + 'async_trait>>where
R: 'async_trait + HttpRequest + Send,
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait, R>(
&'life0 self,
request: R,
) -> Pin<Box<dyn Future<Output = Result<R::Response, Self::ClientError>> + 'async_trait>>where
R: 'async_trait + HttpRequest + Send,
Self: 'async_trait,
'life0: 'async_trait,
Execute a
http_request_derive::HttpRequest, and read the typed response.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 moreAuto Trait Implementations§
impl Freeze for ReqwestClient
impl !RefUnwindSafe for ReqwestClient
impl !Send for ReqwestClient
impl !Sync for ReqwestClient
impl Unpin for ReqwestClient
impl UnsafeUnpin 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