Struct net_traits::response::Response
source · pub struct Response {Show 17 fields
pub response_type: ResponseType,
pub termination_reason: Option<TerminationReason>,
url: Option<ServoUrl>,
pub url_list: Vec<ServoUrl>,
pub status: HttpStatus,
pub headers: HeaderMap,
pub body: Arc<Mutex<ResponseBody>>,
pub cache_state: CacheState,
pub https_state: HttpsState,
pub referrer: Option<ServoUrl>,
pub referrer_policy: ReferrerPolicy,
pub cors_exposed_header_name_list: Vec<String>,
pub location_url: Option<Result<ServoUrl, String>>,
pub internal_response: Option<Box<Response>>,
pub return_internal: bool,
pub aborted: Arc<AtomicBool>,
pub resource_timing: Arc<Mutex<ResourceFetchTiming>>,
}
Expand description
A Response as defined by the Fetch spec
Fields§
§response_type: ResponseType
§termination_reason: Option<TerminationReason>
§url: Option<ServoUrl>
§url_list: Vec<ServoUrl>
§status: HttpStatus
§headers: HeaderMap
§body: Arc<Mutex<ResponseBody>>
§cache_state: CacheState
§https_state: HttpsState
§referrer: Option<ServoUrl>
§referrer_policy: ReferrerPolicy
§cors_exposed_header_name_list: Vec<String>
§location_url: Option<Result<ServoUrl, String>>
§internal_response: Option<Box<Response>>
Internal response, only used if the Response is a filtered response
return_internal: bool
whether or not to try to return the internal_response when asked for actual_response
aborted: Arc<AtomicBool>
§resource_timing: Arc<Mutex<ResourceFetchTiming>>
track network metrics
Implementations§
source§impl Response
impl Response
pub fn new(url: ServoUrl, resource_timing: ResourceFetchTiming) -> Response
pub fn from_init( init: ResponseInit, resource_timing_type: ResourceTimingType, ) -> Response
pub fn network_error(e: NetworkError) -> Response
pub fn network_internal_error<T: Into<String>>(msg: T) -> Response
pub fn url(&self) -> Option<&ServoUrl>
pub fn is_network_error(&self) -> bool
pub fn get_network_error(&self) -> Option<&NetworkError>
pub fn actual_response(&self) -> &Response
pub fn actual_response_mut(&mut self) -> &mut Response
pub fn to_actual(self) -> Response
pub fn get_resource_timing(&self) -> Arc<Mutex<ResourceFetchTiming>>
sourcepub fn to_filtered(self, filter_type: ResponseType) -> Response
pub fn to_filtered(self, filter_type: ResponseType) -> Response
Convert to a filtered response, of type filter_type
.
Do not use with type Error or Default
pub fn metadata(&self) -> Result<FetchMetadata, NetworkError>
Trait Implementations§
source§impl MallocSizeOf for Response
impl MallocSizeOf for Response
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
Auto Trait Implementations§
impl Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnwindSafe for Response
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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>
Converts
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>
Converts
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 moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert