Struct netc::request::Request

source ·
pub struct Request { /* private fields */ }

Implementations§

source§

impl Request

source

pub fn new(method: Method, url: &Url) -> Request

source

pub fn request_line(&self) -> String

Request-Line = Method SP Request-URI SP HTTP-Version CRLF

source

pub fn user_agent(&self) -> Option<String>

source

pub fn referer(&self) -> Option<String>

source

pub fn headers(&mut self, headers: Headers) -> &mut Self

source

pub fn header<T: ToString + ?Sized, U: ToString + ?Sized>( &mut self, key: &T, val: &U ) -> &mut Self

source

pub fn remove_header<T: ToString + ?Sized>(&mut self, key: &T) -> &mut Self

source

pub fn method(&mut self, method: Method) -> &mut Self

source

pub fn version(&mut self, version: Version) -> &mut Self

source

pub fn body<B: Into<Bytes>>(&mut self, value: B) -> &mut Self

source

pub fn opt_body<B: Into<Bytes>>(&mut self, value: Option<B>) -> &mut Self

source

pub fn set_basic_auth(&mut self, username: &str, password: &str) -> &mut Self

source

pub fn set_proxy_basic_auth( &mut self, username: &str, password: &str ) -> &mut Self

source

pub fn to_vec(&self) -> Vec<u8>

source

pub fn content_length(&self) -> Option<usize>

source

pub fn get_body(&self) -> Option<Bytes>

source

pub fn get_headers(&self) -> &Headers

source

pub fn proxy(&mut self, proxy: Option<&Url>)

source

pub fn request_uri(&self) -> String

source

pub fn url(&self) -> Url

Trait Implementations§

source§

impl Clone for Request

source§

fn clone(&self) -> Request

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Request

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.