Struct Request

pub struct Request { /* private fields */ }

A request which can be executed with Client::execute().

Implementations

impl Request

fn new(method: Method, url: Url) -> Self

Constructs a new request.

fn method(&self) -> &Method

Get the method.

fn method_mut(&mut self) -> &mut Method

Get a mutable reference to the method.

fn url(&self) -> &Url

Get the url.

fn url_mut(&mut self) -> &mut Url

Get a mutable reference to the url.

fn headers(&self) -> &HeaderMap

Get the headers.

fn headers_mut(&mut self) -> &mut HeaderMap

Get a mutable reference to the headers.

fn version(&self) -> Version

Get the http version.

fn version_mut(&mut self) -> &mut Version

Get a mutable reference to the http version.

fn body(&self) -> Option<&Body>

Get the body.

fn body_mut(&mut self) -> &mut Option<Body>

Get a mutable reference to the body.

fn timeout(&self) -> Option<&Duration>

Get the timeout.

fn timeout_mut(&mut self) -> &mut Option<Duration>

Get a mutable reference to the timeout.

fn try_clone(&self) -> Option<Request>

Attempts to clone the Request.

None is returned if a body is which can not be cloned. This can be because the body is a stream.

Trait Implementations

impl Debug for Request

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

impl<T> TryFrom<Request<T>> for Request where T: Into<Body>,

type Error = Error;
fn try_from(req: HttpRequest<T>) -> Result<Self>

Auto Trait Implementations

impl !Freeze for Request

impl !RefUnwindSafe for Request

impl !Sync for Request

impl !UnwindSafe for Request

impl Send for Request

impl Unpin for Request

impl UnsafeUnpin for Request

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> From<T> for Request

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for Request

impl<T> PolicyExt for Request where T: ?Sized,

fn and<P, B, E>(self, other: P) -> And<T, P>
where
    T: Sized + Policy<B, E>,
    P: Policy<B, E>,
fn or<P, B, E>(self, other: P) -> Or<T, P>
where
    T: Sized + Policy<B, E>,
    P: Policy<B, E>,

impl<T> WithSubscriber for Request

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

fn into(self) -> U

Calls U::from(self).

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

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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