Skip to main content

web_sys/features/
gen_UsbPermissionDescriptor.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 = USBPermissionDescriptor)]
9    #[derive(Debug, Clone, PartialEq, Eq)]
10    #[doc = "The `UsbPermissionDescriptor` dictionary."]
11    #[doc = ""]
12    #[doc = "*This API requires the following crate features to be activated: `UsbPermissionDescriptor`*"]
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://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
16    pub type UsbPermissionDescriptor;
17    #[cfg(web_sys_unstable_apis)]
18    #[cfg(feature = "PermissionName")]
19    #[doc = "Get the `name` field of this object."]
20    #[doc = ""]
21    #[doc = "*This API requires the following crate features to be activated: `PermissionName`, `UsbPermissionDescriptor`*"]
22    #[doc = ""]
23    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
24    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
25    #[wasm_bindgen(method, getter = "name")]
26    pub fn get_name(this: &UsbPermissionDescriptor) -> PermissionName;
27    #[cfg(web_sys_unstable_apis)]
28    #[cfg(feature = "PermissionName")]
29    #[doc = "Change the `name` field of this object."]
30    #[doc = ""]
31    #[doc = "*This API requires the following crate features to be activated: `PermissionName`, `UsbPermissionDescriptor`*"]
32    #[doc = ""]
33    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
34    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
35    #[wasm_bindgen(method, setter = "name")]
36    pub fn set_name(this: &UsbPermissionDescriptor, val: PermissionName);
37    #[cfg(web_sys_unstable_apis)]
38    #[cfg(feature = "UsbDeviceFilter")]
39    #[doc = "Get the `filters` field of this object."]
40    #[doc = ""]
41    #[doc = "*This API requires the following crate features to be activated: `UsbDeviceFilter`, `UsbPermissionDescriptor`*"]
42    #[doc = ""]
43    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
44    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
45    #[wasm_bindgen(method, getter = "filters")]
46    pub fn get_filters(this: &UsbPermissionDescriptor) -> Option<::js_sys::Array<UsbDeviceFilter>>;
47    #[cfg(web_sys_unstable_apis)]
48    #[cfg(feature = "UsbDeviceFilter")]
49    #[doc = "Change the `filters` field of this object."]
50    #[doc = ""]
51    #[doc = "*This API requires the following crate features to be activated: `UsbDeviceFilter`, `UsbPermissionDescriptor`*"]
52    #[doc = ""]
53    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
54    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
55    #[wasm_bindgen(method, setter = "filters")]
56    pub fn set_filters(this: &UsbPermissionDescriptor, val: &[UsbDeviceFilter]);
57}
58#[cfg(web_sys_unstable_apis)]
59impl UsbPermissionDescriptor {
60    #[cfg(feature = "PermissionName")]
61    #[doc = "Construct a new `UsbPermissionDescriptor`."]
62    #[doc = ""]
63    #[doc = "*This API requires the following crate features to be activated: `PermissionName`, `UsbPermissionDescriptor`*"]
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://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
67    pub fn new(name: PermissionName) -> Self {
68        #[allow(unused_mut)]
69        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
70        ret.set_name(name);
71        ret
72    }
73    #[cfg(web_sys_unstable_apis)]
74    #[cfg(feature = "PermissionName")]
75    #[deprecated = "Use `set_name()` instead."]
76    pub fn name(&mut self, val: PermissionName) -> &mut Self {
77        self.set_name(val);
78        self
79    }
80    #[cfg(web_sys_unstable_apis)]
81    #[cfg(feature = "UsbDeviceFilter")]
82    #[deprecated = "Use `set_filters()` instead."]
83    pub fn filters(&mut self, val: &[UsbDeviceFilter]) -> &mut Self {
84        self.set_filters(val);
85        self
86    }
87}