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    #[doc = "Get the `status` field of this object."]
24    #[doc = ""]
25    #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"]
26    #[wasm_bindgen(method, getter = "status")]
27    pub fn get_status(this: &ResponseInit) -> Option<u16>;
28    #[doc = "Change the `status` field of this object."]
29    #[doc = ""]
30    #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"]
31    #[wasm_bindgen(method, setter = "status")]
32    pub fn set_status(this: &ResponseInit, val: u16);
33    #[doc = "Get the `statusText` field of this object."]
34    #[doc = ""]
35    #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"]
36    #[wasm_bindgen(method, getter = "statusText")]
37    pub fn get_status_text(this: &ResponseInit) -> Option<::alloc::string::String>;
38    #[doc = "Change the `statusText` field of this object."]
39    #[doc = ""]
40    #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"]
41    #[wasm_bindgen(method, setter = "statusText")]
42    pub fn set_status_text(this: &ResponseInit, val: &str);
43}
44impl ResponseInit {
45    #[doc = "Construct a new `ResponseInit`."]
46    #[doc = ""]
47    #[doc = "*This API requires the following crate features to be activated: `ResponseInit`*"]
48    pub fn new() -> Self {
49        #[allow(unused_mut)]
50        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
51        ret
52    }
53    #[deprecated = "Use `set_headers()` instead."]
54    pub fn headers(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
55        self.set_headers(val);
56        self
57    }
58    #[deprecated = "Use `set_status()` instead."]
59    pub fn status(&mut self, val: u16) -> &mut Self {
60        self.set_status(val);
61        self
62    }
63    #[deprecated = "Use `set_status_text()` instead."]
64    pub fn status_text(&mut self, val: &str) -> &mut Self {
65        self.set_status_text(val);
66        self
67    }
68}
69impl Default for ResponseInit {
70    fn default() -> Self {
71        Self::new()
72    }
73}