Skip to main content

web_sys/features/
gen_ResponseInit.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ResponseInit)]
8    #[derive(Debug, Clone, PartialEq, Eq)]
9    #[doc = "The `ResponseInit` dictionary."]
10    #[doc = ""]
11    #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"]
12    pub type ResponseInit;
13    #[doc = "Get the `headers` field of this object."]
14    #[doc = ""]
15    #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"]
16    #[wasm_bindgen(method, getter = "headers")]
17    pub fn get_headers(this: &ResponseInit) -> ::wasm_bindgen::JsValue;
18    #[doc = "Change the `headers` field of this object."]
19    #[doc = ""]
20    #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"]
21    #[wasm_bindgen(method, setter = "headers")]
22    pub fn set_headers(this: &ResponseInit, val: &::wasm_bindgen::JsValue);
23    #[cfg(feature = "Headers")]
24    #[doc = "Change the `headers` field of this object."]
25    #[doc = ""]
26    #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"]
27    #[wasm_bindgen(method, setter = "headers")]
28    pub fn set_headers_headers(this: &ResponseInit, val: &Headers);
29    #[doc = "Change the `headers` field of this object."]
30    #[doc = ""]
31    #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"]
32    #[wasm_bindgen(method, setter = "headers")]
33    pub fn set_headers_str_sequence_sequence(this: &ResponseInit, val: &::wasm_bindgen::JsValue);
34    #[doc = "Change the `headers` field of this object."]
35    #[doc = ""]
36    #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"]
37    #[wasm_bindgen(method, setter = "headers")]
38    pub fn set_headers_record_from_str_to_str(this: &ResponseInit, val: &::js_sys::Object);
39    #[doc = "Get the `status` field of this object."]
40    #[doc = ""]
41    #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"]
42    #[wasm_bindgen(method, getter = "status")]
43    pub fn get_status(this: &ResponseInit) -> Option<u16>;
44    #[doc = "Change the `status` field of this object."]
45    #[doc = ""]
46    #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"]
47    #[wasm_bindgen(method, setter = "status")]
48    pub fn set_status(this: &ResponseInit, val: u16);
49    #[doc = "Get the `statusText` field of this object."]
50    #[doc = ""]
51    #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"]
52    #[wasm_bindgen(method, getter = "statusText")]
53    pub fn get_status_text(this: &ResponseInit) -> Option<::alloc::string::String>;
54    #[doc = "Change the `statusText` field of this object."]
55    #[doc = ""]
56    #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"]
57    #[wasm_bindgen(method, setter = "statusText")]
58    pub fn set_status_text(this: &ResponseInit, val: &str);
59}
60impl ResponseInit {
61    #[doc = "Construct a new `ResponseInit`."]
62    #[doc = ""]
63    #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"]
64    pub fn new() -> Self {
65        #[allow(unused_mut)]
66        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
67        ret
68    }
69    #[deprecated = "Use `set_headers()` instead."]
70    pub fn headers(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
71        self.set_headers(val);
72        self
73    }
74    #[deprecated = "Use `set_status()` instead."]
75    pub fn status(&mut self, val: u16) -> &mut Self {
76        self.set_status(val);
77        self
78    }
79    #[deprecated = "Use `set_status_text()` instead."]
80    pub fn status_text(&mut self, val: &str) -> &mut Self {
81        self.set_status_text(val);
82        self
83    }
84}
85impl Default for ResponseInit {
86    fn default() -> Self {
87        Self::new()
88    }
89}