pub struct RequestBuilder<'r, B> { /* private fields */ }
Expand description

HTTP 请求构建器

Implementations§

source§

impl<'r, B: Default + 'r> RequestBuilder<'r, B>

source

pub fn new() -> Self

创建 HTTP 请求构建器

source§

impl<'r, B: 'r> RequestBuilder<'r, B>

source

pub fn url(&mut self, url: Uri) -> &mut Self

设置请求 URL

source

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

设置请求 HTTP 方法

source

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

设置请求 HTTP 版本

source

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

设置请求 HTTP Headers

source

pub fn header( &mut self, header_name: impl IntoHeaderName, header_value: impl Into<HeaderValue> ) -> &mut Self

插入请求 HTTP Header

source

pub fn body(&mut self, body: B) -> &mut Self

设置请求 HTTP 请求体

source

pub fn extensions(&mut self, extensions: Extensions) -> &mut Self

设置扩展信息

source

pub fn add_extension<T: Sync + Send + 'static>(&mut self, val: T) -> &mut Self

追加扩展信息

source

pub fn appended_user_agent( &mut self, user_agent: impl Into<UserAgent> ) -> &mut Self

设置 UserAgent

source

pub fn resolved_ip_addrs( &mut self, resolved_ip_addrs: impl Into<Cow<'r, [IpAddr]>> ) -> &mut Self

设置预解析的服务器套接字地址

source

pub fn on_uploading_progress( &mut self, f: impl Into<OnProgressCallback<'r>> ) -> &mut Self

设置上传进度回调

source

pub fn on_receive_response_status( &mut self, f: impl Into<OnStatusCodeCallback<'r>> ) -> &mut Self

设置接受到响应状态回调

source

pub fn on_receive_response_header( &mut self, f: impl Into<OnHeaderCallback<'r>> ) -> &mut Self

设置接受到响应 Header 回调

source§

impl<'r, B: Default + 'r> RequestBuilder<'r, B>

source

pub fn build(&mut self) -> Request<'r, B>

构建 HTTP 请求,同时构建器被重置

source

pub fn reset(&mut self)

重置 HTTP 请求构建器

Trait Implementations§

source§

impl<'r, B: Debug> Debug for RequestBuilder<'r, B>

source§

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

Formats the value using the given formatter. Read more
source§

impl<'r, B: Default> Default for RequestBuilder<'r, B>

source§

fn default() -> RequestBuilder<'r, B>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'r, B> !RefUnwindSafe for RequestBuilder<'r, B>

§

impl<'r, B> Send for RequestBuilder<'r, B>
where B: Send,

§

impl<'r, B> Sync for RequestBuilder<'r, B>
where B: Sync,

§

impl<'r, B> Unpin for RequestBuilder<'r, B>
where B: Unpin,

§

impl<'r, B> !UnwindSafe for RequestBuilder<'r, B>

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>,

§

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>,

§

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.