Skip to main content

web_sys/features/
gen_RequestDeviceOptions.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 = RequestDeviceOptions)]
9    #[derive(Debug, Clone, PartialEq, Eq)]
10    #[doc = "The `RequestDeviceOptions` dictionary."]
11    #[doc = ""]
12    #[doc = "*This API requires the following crate features to be activated: `RequestDeviceOptions`*"]
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 RequestDeviceOptions;
17    #[cfg(web_sys_unstable_apis)]
18    #[doc = "Get the `acceptAllDevices` field of this object."]
19    #[doc = ""]
20    #[doc = "*This API requires the following crate features to be activated: `RequestDeviceOptions`*"]
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://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
24    #[wasm_bindgen(method, getter = "acceptAllDevices")]
25    pub fn get_accept_all_devices(this: &RequestDeviceOptions) -> Option<bool>;
26    #[cfg(web_sys_unstable_apis)]
27    #[doc = "Change the `acceptAllDevices` field of this object."]
28    #[doc = ""]
29    #[doc = "*This API requires the following crate features to be activated: `RequestDeviceOptions`*"]
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://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
33    #[wasm_bindgen(method, setter = "acceptAllDevices")]
34    pub fn set_accept_all_devices(this: &RequestDeviceOptions, val: bool);
35    #[cfg(web_sys_unstable_apis)]
36    #[cfg(feature = "BluetoothLeScanFilterInit")]
37    #[doc = "Get the `filters` field of this object."]
38    #[doc = ""]
39    #[doc = "*This API requires the following crate features to be activated: `BluetoothLeScanFilterInit`, `RequestDeviceOptions`*"]
40    #[doc = ""]
41    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
42    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
43    #[wasm_bindgen(method, getter = "filters")]
44    pub fn get_filters(
45        this: &RequestDeviceOptions,
46    ) -> Option<::js_sys::Array<BluetoothLeScanFilterInit>>;
47    #[cfg(web_sys_unstable_apis)]
48    #[cfg(feature = "BluetoothLeScanFilterInit")]
49    #[doc = "Change the `filters` field of this object."]
50    #[doc = ""]
51    #[doc = "*This API requires the following crate features to be activated: `BluetoothLeScanFilterInit`, `RequestDeviceOptions`*"]
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: &RequestDeviceOptions, val: &[BluetoothLeScanFilterInit]);
57    #[cfg(web_sys_unstable_apis)]
58    #[doc = "Get the `optionalServices` field of this object."]
59    #[doc = ""]
60    #[doc = "*This API requires the following crate features to be activated: `RequestDeviceOptions`*"]
61    #[doc = ""]
62    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
63    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
64    #[wasm_bindgen(method, getter = "optionalServices")]
65    pub fn get_optional_services(this: &RequestDeviceOptions) -> Option<::js_sys::Array>;
66    #[cfg(web_sys_unstable_apis)]
67    #[doc = "Change the `optionalServices` field of this object."]
68    #[doc = ""]
69    #[doc = "*This API requires the following crate features to be activated: `RequestDeviceOptions`*"]
70    #[doc = ""]
71    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
72    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
73    #[wasm_bindgen(method, setter = "optionalServices")]
74    pub fn set_optional_services(this: &RequestDeviceOptions, val: &[::js_sys::JsString]);
75    #[cfg(web_sys_unstable_apis)]
76    #[doc = "Change the `optionalServices` field of this object."]
77    #[doc = ""]
78    #[doc = "*This API requires the following crate features to be activated: `RequestDeviceOptions`*"]
79    #[doc = ""]
80    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
81    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
82    #[wasm_bindgen(method, setter = "optionalServices")]
83    pub fn set_optional_services_u32_sequence(
84        this: &RequestDeviceOptions,
85        val: &[::js_sys::Number],
86    );
87}
88#[cfg(web_sys_unstable_apis)]
89impl RequestDeviceOptions {
90    #[doc = "Construct a new `RequestDeviceOptions`."]
91    #[doc = ""]
92    #[doc = "*This API requires the following crate features to be activated: `RequestDeviceOptions`*"]
93    #[doc = ""]
94    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
95    #[doc = "[described in the `wasm-bindgen` guide](https://wasm-bindgen.github.io/wasm-bindgen/web-sys/unstable-apis.html)*"]
96    pub fn new() -> Self {
97        #[allow(unused_mut)]
98        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
99        ret
100    }
101    #[cfg(web_sys_unstable_apis)]
102    #[deprecated = "Use `set_accept_all_devices()` instead."]
103    pub fn accept_all_devices(&mut self, val: bool) -> &mut Self {
104        self.set_accept_all_devices(val);
105        self
106    }
107    #[cfg(web_sys_unstable_apis)]
108    #[cfg(feature = "BluetoothLeScanFilterInit")]
109    #[deprecated = "Use `set_filters()` instead."]
110    pub fn filters(&mut self, val: &[BluetoothLeScanFilterInit]) -> &mut Self {
111        self.set_filters(val);
112        self
113    }
114    #[cfg(web_sys_unstable_apis)]
115    #[deprecated = "Use `set_optional_services()` instead."]
116    pub fn optional_services(&mut self, val: &[::js_sys::JsString]) -> &mut Self {
117        self.set_optional_services(val);
118        self
119    }
120}
121#[cfg(web_sys_unstable_apis)]
122impl Default for RequestDeviceOptions {
123    fn default() -> Self {
124        Self::new()
125    }
126}