pub trait RequestBuilder {
type Error: Error + Send + Sync + 'static;
// Required methods
fn header<K, V>(self, key: K, value: V) -> Self
where HeaderName: TryFrom<K>,
<HeaderName as TryFrom<K>>::Error: Into<Error>,
HeaderValue: TryFrom<V>,
<HeaderValue as TryFrom<V>>::Error: Into<Error>;
fn headers(self, headers: HeaderMap) -> Self;
fn basic_auth<U, P>(self, username: U, password: Option<P>) -> Self
where U: Display,
P: Display;
fn bearer_auth<T>(self, token: T) -> Self
where T: Display;
fn body<T: Into<Body>>(self, body: T) -> Self;
fn json<T: Serialize + ?Sized>(self, json: &T) -> Self;
fn timeout(self, timeout: Duration) -> Self;
fn query<T: Serialize + ?Sized>(self, query: &T) -> Self;
fn version(self, version: Version) -> Self;
fn build(self) -> Result<Request, Error>;
fn send<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<Response, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait;
}
Expand description
The RequestBuilder
trait represents reqwest::RequestBuilder
.
Required Associated Types§
Required Methods§
fn header<K, V>(self, key: K, value: V) -> Selfwhere
HeaderName: TryFrom<K>,
<HeaderName as TryFrom<K>>::Error: Into<Error>,
HeaderValue: TryFrom<V>,
<HeaderValue as TryFrom<V>>::Error: Into<Error>,
fn headers(self, headers: HeaderMap) -> Self
fn basic_auth<U, P>(self, username: U, password: Option<P>) -> Self
fn bearer_auth<T>(self, token: T) -> Selfwhere
T: Display,
fn body<T: Into<Body>>(self, body: T) -> Self
fn json<T: Serialize + ?Sized>(self, json: &T) -> Self
fn timeout(self, timeout: Duration) -> Self
fn query<T: Serialize + ?Sized>(self, query: &T) -> Self
fn version(self, version: Version) -> Self
fn build(self) -> Result<Request, Error>
fn send<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<Response, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
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.