Struct RequestPartsBuilder

Source
pub struct RequestPartsBuilder<'r>(/* private fields */);
Expand description

HTTP 请求信息构建器

不包含请求体信息

Implementations§

Source§

impl<'r> RequestPartsBuilder<'r>

Source

pub fn new() -> Self

创建 HTTP 请求信息构建器

Source

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

设置 HTTP 请求 URL

Source

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

设置请求 HTTP 版本

Source

pub fn method(&mut self, method: Method) -> &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 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

pub fn build(&mut self) -> RequestParts<'r>

创建 HTTP 请求信息

Source

pub fn build_with_body<B: 'r>(&mut self, body: B) -> Request<'r, B>

创建 HTTP 请求

Trait Implementations§

Source§

impl<'r> Debug for RequestPartsBuilder<'r>

Source§

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

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

impl<'r> Default for RequestPartsBuilder<'r>

Source§

fn default() -> RequestPartsBuilder<'r>

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

Auto Trait Implementations§

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.