Trait RequestBuilder

Source
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§

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

fn header<K, V>(self, key: K, value: V) -> Self

Source

fn headers(self, headers: HeaderMap) -> Self

Source

fn basic_auth<U, P>(self, username: U, password: Option<P>) -> Self
where U: Display, P: Display,

Source

fn bearer_auth<T>(self, token: T) -> Self
where T: Display,

Source

fn body<T: Into<Body>>(self, body: T) -> Self

Source

fn json<T: Serialize + ?Sized>(self, json: &T) -> Self

Source

fn timeout(self, timeout: Duration) -> Self

Source

fn query<T: Serialize + ?Sized>(self, query: &T) -> Self

Source

fn version(self, version: Version) -> Self

Source

fn build(self) -> Result<Request, Error>

Source

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.

Implementations on Foreign Types§

Source§

impl RequestBuilder for RequestBuilder

Source§

type Error = Error

Source§

fn header<K, V>(self, key: K, value: V) -> Self

Source§

fn headers(self, headers: HeaderMap) -> Self

Source§

fn basic_auth<U, P>(self, username: U, password: Option<P>) -> Self
where U: Display, P: Display,

Source§

fn bearer_auth<T>(self, token: T) -> Self
where T: Display,

Source§

fn body<T: Into<Body>>(self, body: T) -> Self

Source§

fn json<T: Serialize + ?Sized>(self, json: &T) -> Self

Source§

fn timeout(self, timeout: Duration) -> Self

Source§

fn query<T: Serialize + ?Sized>(self, query: &T) -> Self

Source§

fn version(self, version: Version) -> Self

Source§

fn build(self) -> Result<Request, Error>

Source§

fn send<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<Response, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,

Source§

impl RequestBuilder for RequestBuilder

Source§

type Error = Error

Source§

fn header<K, V>(self, key: K, value: V) -> Self

Source§

fn headers(self, headers: HeaderMap) -> Self

Source§

fn basic_auth<U, P>(self, username: U, password: Option<P>) -> Self
where U: Display, P: Display,

Source§

fn bearer_auth<T>(self, token: T) -> Self
where T: Display,

Source§

fn body<T: Into<Body>>(self, body: T) -> Self

Source§

fn json<T: Serialize + ?Sized>(self, json: &T) -> Self

Source§

fn timeout(self, timeout: Duration) -> Self

Source§

fn query<T: Serialize + ?Sized>(self, query: &T) -> Self

Source§

fn version(self, version: Version) -> Self

Source§

fn build(self) -> Result<Request, Self::Error>

Source§

fn send<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait>>
where Self: 'async_trait,

Implementors§