maxcountryman_web_sys/features/
gen_HidInputReportEventInit.rs

1#![allow(unused_imports)]
2use super::*;
3use wasm_bindgen::prelude::*;
4#[cfg(web_sys_unstable_apis)]
5#[wasm_bindgen]
6extern "C" {
7    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = HIDInputReportEventInit)]
8    #[derive(Debug, Clone, PartialEq, Eq)]
9    #[doc = "The `HidInputReportEventInit` dictionary."]
10    #[doc = ""]
11    #[doc = "*This API requires the following crate features to be activated: `HidInputReportEventInit`*"]
12    #[doc = ""]
13    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
14    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
15    pub type HidInputReportEventInit;
16}
17#[cfg(web_sys_unstable_apis)]
18impl HidInputReportEventInit {
19    #[cfg(feature = "HidDevice")]
20    #[doc = "Construct a new `HidInputReportEventInit`."]
21    #[doc = ""]
22    #[doc = "*This API requires the following crate features to be activated: `HidDevice`, `HidInputReportEventInit`*"]
23    #[doc = ""]
24    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
25    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
26    pub fn new(data: &::js_sys::DataView, device: &HidDevice, report_id: u8) -> Self {
27        #[allow(unused_mut)]
28        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
29        ret.data(data);
30        ret.device(device);
31        ret.report_id(report_id);
32        ret
33    }
34    #[cfg(web_sys_unstable_apis)]
35    #[doc = "Change the `bubbles` field of this object."]
36    #[doc = ""]
37    #[doc = "*This API requires the following crate features to be activated: `HidInputReportEventInit`*"]
38    #[doc = ""]
39    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
40    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
41    pub fn bubbles(&mut self, val: bool) -> &mut Self {
42        use wasm_bindgen::JsValue;
43        let r = ::js_sys::Reflect::set(
44            self.as_ref(),
45            &JsValue::from("bubbles"),
46            &JsValue::from(val),
47        );
48        debug_assert!(
49            r.is_ok(),
50            "setting properties should never fail on our dictionary objects"
51        );
52        let _ = r;
53        self
54    }
55    #[cfg(web_sys_unstable_apis)]
56    #[doc = "Change the `cancelable` field of this object."]
57    #[doc = ""]
58    #[doc = "*This API requires the following crate features to be activated: `HidInputReportEventInit`*"]
59    #[doc = ""]
60    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
61    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
62    pub fn cancelable(&mut self, val: bool) -> &mut Self {
63        use wasm_bindgen::JsValue;
64        let r = ::js_sys::Reflect::set(
65            self.as_ref(),
66            &JsValue::from("cancelable"),
67            &JsValue::from(val),
68        );
69        debug_assert!(
70            r.is_ok(),
71            "setting properties should never fail on our dictionary objects"
72        );
73        let _ = r;
74        self
75    }
76    #[cfg(web_sys_unstable_apis)]
77    #[doc = "Change the `composed` field of this object."]
78    #[doc = ""]
79    #[doc = "*This API requires the following crate features to be activated: `HidInputReportEventInit`*"]
80    #[doc = ""]
81    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
82    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
83    pub fn composed(&mut self, val: bool) -> &mut Self {
84        use wasm_bindgen::JsValue;
85        let r = ::js_sys::Reflect::set(
86            self.as_ref(),
87            &JsValue::from("composed"),
88            &JsValue::from(val),
89        );
90        debug_assert!(
91            r.is_ok(),
92            "setting properties should never fail on our dictionary objects"
93        );
94        let _ = r;
95        self
96    }
97    #[cfg(web_sys_unstable_apis)]
98    #[doc = "Change the `data` field of this object."]
99    #[doc = ""]
100    #[doc = "*This API requires the following crate features to be activated: `HidInputReportEventInit`*"]
101    #[doc = ""]
102    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
103    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
104    pub fn data(&mut self, val: &::js_sys::DataView) -> &mut Self {
105        use wasm_bindgen::JsValue;
106        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("data"), &JsValue::from(val));
107        debug_assert!(
108            r.is_ok(),
109            "setting properties should never fail on our dictionary objects"
110        );
111        let _ = r;
112        self
113    }
114    #[cfg(web_sys_unstable_apis)]
115    #[cfg(feature = "HidDevice")]
116    #[doc = "Change the `device` field of this object."]
117    #[doc = ""]
118    #[doc = "*This API requires the following crate features to be activated: `HidDevice`, `HidInputReportEventInit`*"]
119    #[doc = ""]
120    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
121    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
122    pub fn device(&mut self, val: &HidDevice) -> &mut Self {
123        use wasm_bindgen::JsValue;
124        let r =
125            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("device"), &JsValue::from(val));
126        debug_assert!(
127            r.is_ok(),
128            "setting properties should never fail on our dictionary objects"
129        );
130        let _ = r;
131        self
132    }
133    #[cfg(web_sys_unstable_apis)]
134    #[doc = "Change the `reportId` field of this object."]
135    #[doc = ""]
136    #[doc = "*This API requires the following crate features to be activated: `HidInputReportEventInit`*"]
137    #[doc = ""]
138    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
139    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
140    pub fn report_id(&mut self, val: u8) -> &mut Self {
141        use wasm_bindgen::JsValue;
142        let r = ::js_sys::Reflect::set(
143            self.as_ref(),
144            &JsValue::from("reportId"),
145            &JsValue::from(val),
146        );
147        debug_assert!(
148            r.is_ok(),
149            "setting properties should never fail on our dictionary objects"
150        );
151        let _ = r;
152        self
153    }
154}