Struct qiniu_http::Request

source ·
pub struct Request<'r, B: 'r> { /* private fields */ }
Expand description

HTTP 请求

封装 HTTP 请求相关字段

Implementations§

source§

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

source

pub fn builder() -> RequestBuilder<'r, B>

创建 HTTP 请求构建器

source§

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

source

pub fn body(&self) -> &B

获取请求体

source

pub fn body_mut(&mut self) -> &mut B

获取请求体的可变引用

source

pub fn into_body(self) -> B

转换为 HTTP 请求体

source

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

获取请求信息

source

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

获取请求信息的可变引用

source

pub fn into_parts_and_body(self) -> (RequestParts<'r>, B)

转换为请求信息和请求体

source

pub fn from_parts_and_body(parts: RequestParts<'r>, body: B) -> Self

通过请求信息和请求体创建 HTTP 请求

Methods from Deref<Target = RequestParts<'r>>§

source

pub fn url(&self) -> &Uri

获取 HTTP 请求 URL

source

pub fn url_mut(&mut self) -> &mut Uri

获取 HTTP 请求 URL 的可变引用

source

pub fn version(&self) -> Version

获取请求 HTTP 版本

source

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

获取请求 HTTP 版本的可变引用

source

pub fn method(&self) -> &Method

获取请求 HTTP 方法

source

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

获取请求 HTTP 方法的可变引用

source

pub fn headers(&self) -> &HeaderMap

获取请求 HTTP Headers

source

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

获取请求 HTTP Headers 的可变引用

source

pub fn extensions(&self) -> &Extensions

获取扩展信息

source

pub fn extensions_mut(&mut self) -> &mut Extensions

获取扩展信息的可变引用

source

pub fn user_agent(&self) -> UserAgent

获取 UserAgent

source

pub fn appended_user_agent(&self) -> &UserAgent

获取追加的 UserAgent

source

pub fn appended_user_agent_mut(&mut self) -> &mut UserAgent

获取追加的 UserAgent 的可变引用

source

pub fn resolved_ip_addrs(&self) -> Option<&[IpAddr]>

获取预解析的服务器套接字地址

source

pub fn resolved_ip_addrs_mut(&mut self) -> &mut Option<Cow<'r, [IpAddr]>>

获取预解析的服务器套接字地址的可变引用

source

pub fn on_uploading_progress( &'r self ) -> Option<&'r (dyn Fn(TransferProgressInfo<'_>) -> Result<()> + Send + Sync + 'r)>

获取上传进度回调

source

pub fn on_uploading_progress_mut( &mut self ) -> &mut Option<OnProgressCallback<'r>>

获取上传进度回调的可变引用

source

pub fn on_receive_response_status( &'r self ) -> Option<&'r (dyn Fn(StatusCode) -> Result<()> + Send + Sync + 'r)>

获取接受到响应状态回调

source

pub fn on_receive_response_status_mut( &mut self ) -> &mut Option<OnStatusCodeCallback<'r>>

获取接受到响应状态回调的可变引用

source

pub fn on_receive_response_header( &'r self ) -> Option<&'r (dyn Fn(&HeaderName, &HeaderValue) -> Result<()> + Send + Sync + 'r)>

获取接受到响应 Header 回调

source

pub fn on_receive_response_header_mut( &mut self ) -> &mut Option<OnHeaderCallback<'r>>

获取接受到响应 Header 回调的可变引用

Trait Implementations§

source§

impl<'r, B: Debug + 'r> Debug for Request<'r, B>

source§

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

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

impl<'r, B: Default + 'r> Default for Request<'r, B>

source§

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

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

impl<'r, B: 'r> Deref for Request<'r, B>

§

type Target = RequestParts<'r>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'r, B: 'r> DerefMut for Request<'r, B>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

impl<'r, B> !UnwindSafe for Request<'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.