#[repr(C)]pub struct Response {
reflector_: Reflector,
headers_reflector: MutNullableDom<Headers>,
mime_type: DomRefCell<Vec<u8>>,
status: DomRefCell<Option<StatusCode>>,
raw_status: DomRefCell<Option<(u16, Vec<u8>)>>,
response_type: DomRefCell<DOMResponseType>,
url: DomRefCell<Option<ServoUrl>>,
url_list: DomRefCell<Vec<ServoUrl>>,
body_stream: MutNullableDom<ReadableStream>,
stream_consumer: DomRefCell<Option<StreamConsumer>>,
redirected: DomRefCell<bool>,
}
Fields
reflector_: Reflector
headers_reflector: MutNullableDom<Headers>
mime_type: DomRefCell<Vec<u8>>
status: DomRefCell<Option<StatusCode>>
None
can be considered a StatusCode of 0
.
raw_status: DomRefCell<Option<(u16, Vec<u8>)>>
response_type: DomRefCell<DOMResponseType>
url: DomRefCell<Option<ServoUrl>>
url_list: DomRefCell<Vec<ServoUrl>>
body_stream: MutNullableDom<ReadableStream>
The stream of https://fetch.spec.whatwg.org/#body.
stream_consumer: DomRefCell<Option<StreamConsumer>>
redirected: DomRefCell<bool>
Implementations
sourceimpl Response
impl Response
fn __assert_parent_type(&self)
sourceimpl Response
impl Response
pub fn new_inherited(global: &GlobalScope) -> Response
pub fn new(global: &GlobalScope) -> Root<Dom<Response>>
pub fn Constructor(
global: &GlobalScope,
body: Option<BodyInit>,
init: &ResponseInit
) -> Result<Root<Dom<Response>>, Error>
pub fn Error(global: &GlobalScope) -> Root<Dom<Response>>
pub fn Redirect(
global: &GlobalScope,
url: USVString,
status: u16
) -> Result<Root<Dom<Response>>, Error>
pub fn error_stream(&self, error: Error)
sourceimpl Response
impl Response
pub fn set_type(&self, new_response_type: DOMResponseType)
pub fn set_headers(&self, option_hyper_headers: Option<Serde<HyperHeaders>>)
pub fn set_raw_status(&self, status: Option<(u16, Vec<u8>)>)
pub fn set_final_url(&self, final_url: ServoUrl)
pub fn set_redirected(&self, is_redirected: bool)
fn set_response_members_by_type(&self, response_type: DOMResponseType)
pub fn set_stream_consumer(&self, sc: Option<StreamConsumer>)
pub fn stream_chunk(&self, chunk: Vec<u8>)
pub fn finish(&self)
Trait Implementations
sourceimpl DomObjectWrap for Response
impl DomObjectWrap for Response
sourceconst WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Box<Self>) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::ResponseBinding::ResponseBinding::Wrap as for<'a> unsafe fn(script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::boxed::Box<dom::response::Response>) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::response::Response>>}
const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Box<Self>) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::ResponseBinding::ResponseBinding::Wrap as for<'a> unsafe fn(script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::boxed::Box<dom::response::Response>) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::response::Response>>}
Function pointer to the general wrap function type
sourceimpl IDLInterface for Response
impl IDLInterface for Response
sourceimpl MallocSizeOf for Response
impl MallocSizeOf for Response
sourcefn 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. Read more
sourceimpl MutDomObject for Response
impl MutDomObject for Response
sourceunsafe fn init_reflector(&self, obj: *mut JSObject)
unsafe fn init_reflector(&self, obj: *mut JSObject)
Initializes the Reflector
sourceimpl ResponseMethods for Response
impl ResponseMethods for Response
fn Type(&self) -> DOMResponseType
fn Url(&self) -> USVString
fn Redirected(&self) -> bool
fn Status(&self) -> u16
fn Ok(&self) -> bool
fn StatusText(&self) -> ByteString
fn Headers(&self) -> Root<Dom<Headers>>
fn Clone(&self) -> Result<Root<Dom<Response>>, Error>
fn BodyUsed(&self) -> bool
fn Text(&self) -> Rc<Promise>
fn Blob(&self) -> Rc<Promise>
fn FormData(&self) -> Rc<Promise>
fn Json(&self) -> Rc<Promise>
fn ArrayBuffer(&self) -> Rc<Promise>
sourceimpl ToJSValConvertible for Response
impl ToJSValConvertible for Response
sourceunsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue<'_>)
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue<'_>)
Convert
self
to a JSVal
. JSAPI failure causes a panic.Auto Trait Implementations
impl !RefUnwindSafe for Response
impl !Send for Response
impl !Sync for Response
impl Unpin for Response
impl !UnwindSafe for Response
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> MaybeBoxed<Box<T, Global>> for T
impl<T> MaybeBoxed<Box<T, Global>> for T
sourcefn maybe_boxed(self) -> Box<T, Global>
fn maybe_boxed(self) -> Box<T, Global>
Convert
sourceimpl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
sourcefn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert