RequestBuilder

Struct RequestBuilder 

Source
pub struct RequestBuilder<'a, C: 'a, E = BytesEncoder, D = RemainingBytesDecoder> { /* private fields */ }
Expand description

HTTP request builder.

This is created by calling Client::request method.

Implementations§

Source§

impl<'a, C, E, D> RequestBuilder<'a, C, E, D>
where C: AcquireConnection + 'a, E: Encode, D: Decode,

Source

pub fn get(self) -> impl Future<Item = Response<D::Item>, Error = Error>

Executes GET request.

Source

pub fn head(self) -> impl Future<Item = Response<()>, Error = Error>

Executes HEAD request.

Source

pub fn delete(self) -> impl Future<Item = Response<D::Item>, Error = Error>

Executes DELETE request.

Source

pub fn put( self, body: E::Item, ) -> impl Future<Item = Response<D::Item>, Error = Error>

Executes PUT request.

Source

pub fn post( self, body: E::Item, ) -> impl Future<Item = Response<D::Item>, Error = Error>

Executes POST request.

Source

pub fn header_field<N, V>(self, name: N, value: V) -> Self
where N: Into<Cow<'a, str>>, V: Into<Cow<'a, str>>,

Adds a field to the tail of the HTTP header of the request.

Source

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

Sets the timeout of the request.

Source

pub fn encoder<T>(self, encoder: T) -> RequestBuilder<'a, C, T, D>

Sets the encoder for serializing the body of the HTTP request.

This is only meaningful at the case the method of the request is PUT or POST.

Source

pub fn decoder<T>(self, decoder: T) -> RequestBuilder<'a, C, E, T>

Sets the decoder for deserializing the body of the HTTP response replied from the server.

The decoder is unused if the method of the request is HEAD.

Trait Implementations§

Source§

impl<'a, C: Debug + 'a, E: Debug, D: Debug> Debug for RequestBuilder<'a, C, E, D>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, C, E, D> Freeze for RequestBuilder<'a, C, E, D>
where E: Freeze, D: Freeze,

§

impl<'a, C, E, D> RefUnwindSafe for RequestBuilder<'a, C, E, D>

§

impl<'a, C, E, D> Send for RequestBuilder<'a, C, E, D>
where E: Send, D: Send, C: Send,

§

impl<'a, C, E, D> Sync for RequestBuilder<'a, C, E, D>
where E: Sync, D: Sync, C: Sync,

§

impl<'a, C, E, D> Unpin for RequestBuilder<'a, C, E, D>
where E: Unpin, D: Unpin,

§

impl<'a, C, E = BytesEncoder, D = RemainingBytesDecoder> !UnwindSafe for RequestBuilder<'a, C, E, D>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,