pub trait RequestBuilder: Debug {
type ReturnValue;
type ClientBuilder;
// Required methods
fn new(method: Method, url: &str, client: &Self::ClientBuilder) -> Self;
fn body(self, b: String) -> Self;
fn header<K, V>(self, key: K, val: V) -> Self
where HeaderName: TryFrom<K>,
HeaderValue: TryFrom<V>,
<HeaderName as TryFrom<K>>::Error: Into<Error>,
<HeaderValue as TryFrom<V>>::Error: Into<Error>;
fn send(self) -> Result<Self::ReturnValue, Error>
where Self: Sized;
}
Expand description
A generic request builder. Allows you to use any HTTP client.
See DefaultRequestBuilder
for one that uses reqwest::Client
.
Required Associated Types§
Sourcetype ReturnValue
type ReturnValue
Generic return value allows you to return a future, allowing the possibility
of using this library in async
environments.
Sourcetype ClientBuilder
type ClientBuilder
This is useful for reusing existing connection pools.
Required Methods§
Sourcefn new(method: Method, url: &str, client: &Self::ClientBuilder) -> Self
fn new(method: Method, url: &str, client: &Self::ClientBuilder) -> Self
Construct the request builder
Sourcefn header<K, V>(self, key: K, val: V) -> Selfwhere
HeaderName: TryFrom<K>,
HeaderValue: TryFrom<V>,
<HeaderName as TryFrom<K>>::Error: Into<Error>,
<HeaderValue as TryFrom<V>>::Error: Into<Error>,
fn header<K, V>(self, key: K, val: V) -> Selfwhere
HeaderName: TryFrom<K>,
HeaderValue: TryFrom<V>,
<HeaderName as TryFrom<K>>::Error: Into<Error>,
<HeaderValue as TryFrom<V>>::Error: Into<Error>,
Set a header
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
Source§impl RequestBuilder for DefaultRequestBuilder
Available on crate feature reqwest-blocking
only.
impl RequestBuilder for DefaultRequestBuilder
Available on crate feature
reqwest-blocking
only.