1 #![allow(unused_imports)]
2 use super::*;
3 use wasm_bindgen::prelude::*;
4 #[cfg(web_sys_unstable_apis)]
5 #[wasm_bindgen]
6 extern "C" {
7     # [wasm_bindgen (extends = :: js_sys :: Object , js_name = USBControlTransferParameters)]
8     #[derive(Debug, Clone, PartialEq, Eq)]
9     #[doc = "The `UsbControlTransferParameters` dictionary."]
10     #[doc = ""]
11     #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`*"]
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 UsbControlTransferParameters;
16 }
17 #[cfg(web_sys_unstable_apis)]
18 impl UsbControlTransferParameters {
19     #[cfg(all(feature = "UsbRecipient", feature = "UsbRequestType",))]
20     #[doc = "Construct a new `UsbControlTransferParameters`."]
21     #[doc = ""]
22     #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`, `UsbRecipient`, `UsbRequestType`*"]
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)*"]
new( index: u16, recipient: UsbRecipient, request: u8, request_type: UsbRequestType, value: u16, ) -> Self26     pub fn new(
27         index: u16,
28         recipient: UsbRecipient,
29         request: u8,
30         request_type: UsbRequestType,
31         value: u16,
32     ) -> Self {
33         #[allow(unused_mut)]
34         let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
35         ret.index(index);
36         ret.recipient(recipient);
37         ret.request(request);
38         ret.request_type(request_type);
39         ret.value(value);
40         ret
41     }
42     #[cfg(web_sys_unstable_apis)]
43     #[doc = "Change the `index` field of this object."]
44     #[doc = ""]
45     #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`*"]
46     #[doc = ""]
47     #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
48     #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
index(&mut self, val: u16) -> &mut Self49     pub fn index(&mut self, val: u16) -> &mut Self {
50         use wasm_bindgen::JsValue;
51         let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("index"), &JsValue::from(val));
52         debug_assert!(
53             r.is_ok(),
54             "setting properties should never fail on our dictionary objects"
55         );
56         let _ = r;
57         self
58     }
59     #[cfg(web_sys_unstable_apis)]
60     #[cfg(feature = "UsbRecipient")]
61     #[doc = "Change the `recipient` field of this object."]
62     #[doc = ""]
63     #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`, `UsbRecipient`*"]
64     #[doc = ""]
65     #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
66     #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
recipient(&mut self, val: UsbRecipient) -> &mut Self67     pub fn recipient(&mut self, val: UsbRecipient) -> &mut Self {
68         use wasm_bindgen::JsValue;
69         let r = ::js_sys::Reflect::set(
70             self.as_ref(),
71             &JsValue::from("recipient"),
72             &JsValue::from(val),
73         );
74         debug_assert!(
75             r.is_ok(),
76             "setting properties should never fail on our dictionary objects"
77         );
78         let _ = r;
79         self
80     }
81     #[cfg(web_sys_unstable_apis)]
82     #[doc = "Change the `request` field of this object."]
83     #[doc = ""]
84     #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`*"]
85     #[doc = ""]
86     #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
87     #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
request(&mut self, val: u8) -> &mut Self88     pub fn request(&mut self, val: u8) -> &mut Self {
89         use wasm_bindgen::JsValue;
90         let r = ::js_sys::Reflect::set(
91             self.as_ref(),
92             &JsValue::from("request"),
93             &JsValue::from(val),
94         );
95         debug_assert!(
96             r.is_ok(),
97             "setting properties should never fail on our dictionary objects"
98         );
99         let _ = r;
100         self
101     }
102     #[cfg(web_sys_unstable_apis)]
103     #[cfg(feature = "UsbRequestType")]
104     #[doc = "Change the `requestType` field of this object."]
105     #[doc = ""]
106     #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`, `UsbRequestType`*"]
107     #[doc = ""]
108     #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
109     #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
request_type(&mut self, val: UsbRequestType) -> &mut Self110     pub fn request_type(&mut self, val: UsbRequestType) -> &mut Self {
111         use wasm_bindgen::JsValue;
112         let r = ::js_sys::Reflect::set(
113             self.as_ref(),
114             &JsValue::from("requestType"),
115             &JsValue::from(val),
116         );
117         debug_assert!(
118             r.is_ok(),
119             "setting properties should never fail on our dictionary objects"
120         );
121         let _ = r;
122         self
123     }
124     #[cfg(web_sys_unstable_apis)]
125     #[doc = "Change the `value` field of this object."]
126     #[doc = ""]
127     #[doc = "*This API requires the following crate features to be activated: `UsbControlTransferParameters`*"]
128     #[doc = ""]
129     #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
130     #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
value(&mut self, val: u16) -> &mut Self131     pub fn value(&mut self, val: u16) -> &mut Self {
132         use wasm_bindgen::JsValue;
133         let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("value"), &JsValue::from(val));
134         debug_assert!(
135             r.is_ok(),
136             "setting properties should never fail on our dictionary objects"
137         );
138         let _ = r;
139         self
140     }
141 }
142