web_sys/features/
gen_AllowedUsbDevice.rs

1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[cfg(web_sys_unstable_apis)]
6#[wasm_bindgen]
7extern "C" {
8    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = AllowedUSBDevice)]
9    #[derive(Debug, Clone, PartialEq, Eq)]
10    #[doc = "The `AllowedUsbDevice` dictionary."]
11    #[doc = ""]
12    #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"]
13    #[doc = ""]
14    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
15    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
16    pub type AllowedUsbDevice;
17    #[cfg(web_sys_unstable_apis)]
18    #[doc = "Get the `productId` field of this object."]
19    #[doc = ""]
20    #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"]
21    #[doc = ""]
22    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
23    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
24    #[wasm_bindgen(method, getter = "productId")]
25    pub fn get_product_id(this: &AllowedUsbDevice) -> u8;
26    #[cfg(web_sys_unstable_apis)]
27    #[doc = "Change the `productId` field of this object."]
28    #[doc = ""]
29    #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"]
30    #[doc = ""]
31    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
32    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
33    #[wasm_bindgen(method, setter = "productId")]
34    pub fn set_product_id(this: &AllowedUsbDevice, val: u8);
35    #[cfg(web_sys_unstable_apis)]
36    #[doc = "Get the `serialNumber` field of this object."]
37    #[doc = ""]
38    #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"]
39    #[doc = ""]
40    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
41    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
42    #[wasm_bindgen(method, getter = "serialNumber")]
43    pub fn get_serial_number(this: &AllowedUsbDevice) -> Option<::alloc::string::String>;
44    #[cfg(web_sys_unstable_apis)]
45    #[doc = "Change the `serialNumber` field of this object."]
46    #[doc = ""]
47    #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"]
48    #[doc = ""]
49    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
50    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
51    #[wasm_bindgen(method, setter = "serialNumber")]
52    pub fn set_serial_number(this: &AllowedUsbDevice, val: &str);
53    #[cfg(web_sys_unstable_apis)]
54    #[doc = "Get the `vendorId` field of this object."]
55    #[doc = ""]
56    #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"]
57    #[doc = ""]
58    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
59    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
60    #[wasm_bindgen(method, getter = "vendorId")]
61    pub fn get_vendor_id(this: &AllowedUsbDevice) -> u8;
62    #[cfg(web_sys_unstable_apis)]
63    #[doc = "Change the `vendorId` field of this object."]
64    #[doc = ""]
65    #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"]
66    #[doc = ""]
67    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
68    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
69    #[wasm_bindgen(method, setter = "vendorId")]
70    pub fn set_vendor_id(this: &AllowedUsbDevice, val: u8);
71}
72#[cfg(web_sys_unstable_apis)]
73impl AllowedUsbDevice {
74    #[doc = "Construct a new `AllowedUsbDevice`."]
75    #[doc = ""]
76    #[doc = "*This API requires the following crate features to be activated: `AllowedUsbDevice`*"]
77    #[doc = ""]
78    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
79    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
80    pub fn new(product_id: u8, vendor_id: u8) -> Self {
81        #[allow(unused_mut)]
82        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
83        ret.set_product_id(product_id);
84        ret.set_vendor_id(vendor_id);
85        ret
86    }
87    #[cfg(web_sys_unstable_apis)]
88    #[deprecated = "Use `set_product_id()` instead."]
89    pub fn product_id(&mut self, val: u8) -> &mut Self {
90        self.set_product_id(val);
91        self
92    }
93    #[cfg(web_sys_unstable_apis)]
94    #[deprecated = "Use `set_serial_number()` instead."]
95    pub fn serial_number(&mut self, val: &str) -> &mut Self {
96        self.set_serial_number(val);
97        self
98    }
99    #[cfg(web_sys_unstable_apis)]
100    #[deprecated = "Use `set_vendor_id()` instead."]
101    pub fn vendor_id(&mut self, val: u8) -> &mut Self {
102        self.set_vendor_id(val);
103        self
104    }
105}