pub trait RequestBuilderExt {
// Required methods
fn with_retry(self) -> RetriableRequestBuilder;
fn send_json<'async_trait, T>(
self,
) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned + 'static,
Self: 'async_trait;
fn send_xml<'async_trait, T>(
self,
) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>
where T: 'async_trait + DeserializeOwned + 'static,
Self: 'async_trait;
fn send_no_response<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait;
fn send_raw<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where Self: 'async_trait;
}Expand description
Extension trait for reqwest::RequestBuilder to add JSON and XML response handling
Required Methods§
Sourcefn with_retry(self) -> RetriableRequestBuilder
fn with_retry(self) -> RetriableRequestBuilder
Enable retries with an exponential back-off strategy.
Example:
ⓘ
let obj: MyType = client
.get("https://api.example.com/obj")
.with_retry() // <- enable retries
.send_json() // <- deserialize JSON body
.await?;Sourcefn send_json<'async_trait, T>(
self,
) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + 'static,
Self: 'async_trait,
fn send_json<'async_trait, T>(
self,
) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + 'static,
Self: 'async_trait,
Send the request and parse the response as JSON
Sourcefn send_xml<'async_trait, T>(
self,
) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + 'static,
Self: 'async_trait,
fn send_xml<'async_trait, T>(
self,
) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + 'static,
Self: 'async_trait,
Send the request and parse the response as XML
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".