pub struct Client { /* private fields */ }
Expand description
Client is the standard, non-testing implementation of AbstractClient. If debug assersions are enabled, then this structure also provides a mechanism for recording an HTTP session.
Implementations§
Trait Implementations§
source§impl AbstractClient for Client
impl AbstractClient for Client
source§fn execute(&self, request: Request) -> Result<(ResponseMetadata, Vec<u8>)>
fn execute(&self, request: Request) -> Result<(ResponseMetadata, Vec<u8>)>
Execute (send) a previously-constructed HTTP request.
source§fn get(&self, url: Url) -> RequestBuilder
fn get(&self, url: Url) -> RequestBuilder
Returns a builder for an HTTP GET request.
source§fn post(&self, url: Url) -> RequestBuilder
fn post(&self, url: Url) -> RequestBuilder
Returns a builder for an HTTP POST request.
source§fn put(&self, url: Url) -> RequestBuilder
fn put(&self, url: Url) -> RequestBuilder
Returns a builder for an HTTP PUT request.
source§fn patch(&self, url: Url) -> RequestBuilder
fn patch(&self, url: Url) -> RequestBuilder
Returns a builder for an HTTP PATCH request.
source§fn delete(&self, url: Url) -> RequestBuilder
fn delete(&self, url: Url) -> RequestBuilder
Returns a builder for an HTTP DELETE request.
source§fn head(&self, url: Url) -> RequestBuilder
fn head(&self, url: Url) -> RequestBuilder
Returns a builder for an HTTP HEAD request.
source§fn sleep(&self, sleep: fn(_: Duration), duration: Duration)
fn sleep(&self, sleep: fn(_: Duration), duration: Duration)
This function calls the given custom sleep function with the given
Duration. This can be overridden by a trait implementor to add extra
logic, if needed.
source§fn execute_with_retries(
&self,
max_retries: usize,
add_jitter: bool,
method: Method,
url: Url,
headers: Option<&HeaderMap>,
body: Option<&[u8]>
) -> Result<(ResponseMetadata, Vec<u8>)>
fn execute_with_retries( &self, max_retries: usize, add_jitter: bool, method: Method, url: Url, headers: Option<&HeaderMap>, body: Option<&[u8]> ) -> Result<(ResponseMetadata, Vec<u8>)>
Execute (send) a previously-constructed HTTP request. In the case of a
retryable failure (a 5xx error), we’ll retry up to max_retries with
exponential backoff between each attempt. Read more
source§fn execute_with_retries_custom_sleep(
&self,
sleep: fn(_: Duration),
max_retries: usize,
add_jitter: bool,
method: Method,
url: Url,
headers: Option<&HeaderMap>,
body: Option<&[u8]>
) -> Result<(ResponseMetadata, Vec<u8>)>
fn execute_with_retries_custom_sleep( &self, sleep: fn(_: Duration), max_retries: usize, add_jitter: bool, method: Method, url: Url, headers: Option<&HeaderMap>, body: Option<&[u8]> ) -> Result<(ResponseMetadata, Vec<u8>)>
This is the same as execute_with_retries, but you can specify a custom
sleep function (as opposed to std::thread::sleep).
Auto Trait Implementations§
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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