pub struct Request { /* private fields */ }Expand description
Request 本地状态(Network 事件链产生的请求记录)。
@trace REQ-BAO-API-006 [class:Request]
Implementations§
Source§impl Request
impl Request
Sourcepub fn new(id: impl Into<String>) -> Request
pub fn new(id: impl Into<String>) -> Request
构造新 Request(初始全空,由事件填入)。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn set_url(&self, url: impl Into<String>)
pub fn set_url(&self, url: impl Into<String>)
设置 URL(requestWillBeSent 事件填入)。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn set_method(&self, m: impl Into<String>)
pub fn set_method(&self, m: impl Into<String>)
设置 method。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn headers(&self) -> HashMap<String, String>
pub fn headers(&self) -> HashMap<String, String>
请求头(克隆)。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn set_headers(&self, h: HashMap<String, String>)
pub fn set_headers(&self, h: HashMap<String, String>)
设置 / 替换 headers。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn add_header(&self, name: impl Into<String>, value: impl Into<String>)
pub fn add_header(&self, name: impl Into<String>, value: impl Into<String>)
添加单个 header。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn set_post_data(&self, p: impl Into<String>)
pub fn set_post_data(&self, p: impl Into<String>)
设置 POST body。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn post_data_json(&self) -> Option<Value>
pub fn post_data_json(&self) -> Option<Value>
POST body 的 JSON 表示(本地缓存)。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn set_post_data_json(&self, v: Value)
pub fn set_post_data_json(&self, v: Value)
设置 POST JSON。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn resource_type(&self) -> String
pub fn resource_type(&self) -> String
资源类型。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn set_resource_type(&self, t: impl Into<String>)
pub fn set_resource_type(&self, t: impl Into<String>)
设置 resource type。
@trace REQ-BAO-API-006 [class:Request]
是否导航请求。
@trace REQ-BAO-API-006 [class:Request]
设置 is_navigation。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn redirected_from(&self) -> Option<Rc<Request>>
pub fn redirected_from(&self) -> Option<Rc<Request>>
重定向来源(本地 weak)。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn set_redirected_from(&self, prev: Weak<Request>)
pub fn set_redirected_from(&self, prev: Weak<Request>)
设置 redirected_from。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn redirected_to(&self) -> Option<Rc<Request>>
pub fn redirected_to(&self) -> Option<Rc<Request>>
重定向目标。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn set_redirected_to(&self, next: Rc<Request>)
pub fn set_redirected_to(&self, next: Rc<Request>)
设置 redirected_to。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn set_failure(&self, msg: impl Into<String>)
pub fn set_failure(&self, msg: impl Into<String>)
设置 failure。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn response(&self) -> Option<Rc<Response>>
pub fn response(&self) -> Option<Rc<Response>>
关联 Response(weak 引用,响应可能已 drop)。
@trace REQ-BAO-API-006 [class:Request]
Sourcepub fn set_response(&self, r: Weak<Response>)
pub fn set_response(&self, r: Weak<Response>)
设置 Response(双向链接,responseCreated 事件填入)。
@trace REQ-BAO-API-006 [class:Request]
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Request
impl !RefUnwindSafe for Request
impl !Send for Request
impl !Sync for Request
impl !UnwindSafe for Request
impl Unpin for Request
impl UnsafeUnpin for Request
Blanket Implementations§
Source§impl<T> AsCtxPtr for Twhere
T: ?Sized,
impl<T> AsCtxPtr for Twhere
T: ?Sized,
Source§fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
self’s address as *mut Self for deferred-task / scopeguard /
ref_guard ctx slots. The closures/trampolines deref it as shared
(&*p) — every method they reach is &self post-R-2, so no write
provenance is required; the *mut spelling is purely to match the
existing DerefOnDrop / HasAutoFlush / RefCount ABI.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more