web_sys/features/
gen_SerialOptions.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 = SerialOptions)]
9    #[derive(Debug, Clone, PartialEq, Eq)]
10    #[doc = "The `SerialOptions` dictionary."]
11    #[doc = ""]
12    #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"]
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 SerialOptions;
17    #[cfg(web_sys_unstable_apis)]
18    #[doc = "Get the `baudRate` field of this object."]
19    #[doc = ""]
20    #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"]
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 = "baudRate")]
25    pub fn get_baud_rate(this: &SerialOptions) -> u32;
26    #[cfg(web_sys_unstable_apis)]
27    #[doc = "Change the `baudRate` field of this object."]
28    #[doc = ""]
29    #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"]
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 = "baudRate")]
34    pub fn set_baud_rate(this: &SerialOptions, val: u32);
35    #[cfg(web_sys_unstable_apis)]
36    #[doc = "Get the `bufferSize` field of this object."]
37    #[doc = ""]
38    #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"]
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 = "bufferSize")]
43    pub fn get_buffer_size(this: &SerialOptions) -> Option<u32>;
44    #[cfg(web_sys_unstable_apis)]
45    #[doc = "Change the `bufferSize` field of this object."]
46    #[doc = ""]
47    #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"]
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 = "bufferSize")]
52    pub fn set_buffer_size(this: &SerialOptions, val: u32);
53    #[cfg(web_sys_unstable_apis)]
54    #[doc = "Get the `dataBits` field of this object."]
55    #[doc = ""]
56    #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"]
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 = "dataBits")]
61    pub fn get_data_bits(this: &SerialOptions) -> Option<u8>;
62    #[cfg(web_sys_unstable_apis)]
63    #[doc = "Change the `dataBits` field of this object."]
64    #[doc = ""]
65    #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"]
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 = "dataBits")]
70    pub fn set_data_bits(this: &SerialOptions, val: u8);
71    #[cfg(web_sys_unstable_apis)]
72    #[cfg(feature = "FlowControlType")]
73    #[doc = "Get the `flowControl` field of this object."]
74    #[doc = ""]
75    #[doc = "*This API requires the following crate features to be activated: `FlowControlType`, `SerialOptions`*"]
76    #[doc = ""]
77    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
78    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
79    #[wasm_bindgen(method, getter = "flowControl")]
80    pub fn get_flow_control(this: &SerialOptions) -> Option<FlowControlType>;
81    #[cfg(web_sys_unstable_apis)]
82    #[cfg(feature = "FlowControlType")]
83    #[doc = "Change the `flowControl` field of this object."]
84    #[doc = ""]
85    #[doc = "*This API requires the following crate features to be activated: `FlowControlType`, `SerialOptions`*"]
86    #[doc = ""]
87    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
88    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
89    #[wasm_bindgen(method, setter = "flowControl")]
90    pub fn set_flow_control(this: &SerialOptions, val: FlowControlType);
91    #[cfg(web_sys_unstable_apis)]
92    #[cfg(feature = "ParityType")]
93    #[doc = "Get the `parity` field of this object."]
94    #[doc = ""]
95    #[doc = "*This API requires the following crate features to be activated: `ParityType`, `SerialOptions`*"]
96    #[doc = ""]
97    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
98    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
99    #[wasm_bindgen(method, getter = "parity")]
100    pub fn get_parity(this: &SerialOptions) -> Option<ParityType>;
101    #[cfg(web_sys_unstable_apis)]
102    #[cfg(feature = "ParityType")]
103    #[doc = "Change the `parity` field of this object."]
104    #[doc = ""]
105    #[doc = "*This API requires the following crate features to be activated: `ParityType`, `SerialOptions`*"]
106    #[doc = ""]
107    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
108    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
109    #[wasm_bindgen(method, setter = "parity")]
110    pub fn set_parity(this: &SerialOptions, val: ParityType);
111    #[cfg(web_sys_unstable_apis)]
112    #[doc = "Get the `stopBits` field of this object."]
113    #[doc = ""]
114    #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"]
115    #[doc = ""]
116    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
117    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
118    #[wasm_bindgen(method, getter = "stopBits")]
119    pub fn get_stop_bits(this: &SerialOptions) -> Option<u8>;
120    #[cfg(web_sys_unstable_apis)]
121    #[doc = "Change the `stopBits` field of this object."]
122    #[doc = ""]
123    #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"]
124    #[doc = ""]
125    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
126    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
127    #[wasm_bindgen(method, setter = "stopBits")]
128    pub fn set_stop_bits(this: &SerialOptions, val: u8);
129}
130#[cfg(web_sys_unstable_apis)]
131impl SerialOptions {
132    #[doc = "Construct a new `SerialOptions`."]
133    #[doc = ""]
134    #[doc = "*This API requires the following crate features to be activated: `SerialOptions`*"]
135    #[doc = ""]
136    #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
137    #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
138    pub fn new(baud_rate: u32) -> Self {
139        #[allow(unused_mut)]
140        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
141        ret.set_baud_rate(baud_rate);
142        ret
143    }
144    #[cfg(web_sys_unstable_apis)]
145    #[deprecated = "Use `set_baud_rate()` instead."]
146    pub fn baud_rate(&mut self, val: u32) -> &mut Self {
147        self.set_baud_rate(val);
148        self
149    }
150    #[cfg(web_sys_unstable_apis)]
151    #[deprecated = "Use `set_buffer_size()` instead."]
152    pub fn buffer_size(&mut self, val: u32) -> &mut Self {
153        self.set_buffer_size(val);
154        self
155    }
156    #[cfg(web_sys_unstable_apis)]
157    #[deprecated = "Use `set_data_bits()` instead."]
158    pub fn data_bits(&mut self, val: u8) -> &mut Self {
159        self.set_data_bits(val);
160        self
161    }
162    #[cfg(web_sys_unstable_apis)]
163    #[cfg(feature = "FlowControlType")]
164    #[deprecated = "Use `set_flow_control()` instead."]
165    pub fn flow_control(&mut self, val: FlowControlType) -> &mut Self {
166        self.set_flow_control(val);
167        self
168    }
169    #[cfg(web_sys_unstable_apis)]
170    #[cfg(feature = "ParityType")]
171    #[deprecated = "Use `set_parity()` instead."]
172    pub fn parity(&mut self, val: ParityType) -> &mut Self {
173        self.set_parity(val);
174        self
175    }
176    #[cfg(web_sys_unstable_apis)]
177    #[deprecated = "Use `set_stop_bits()` instead."]
178    pub fn stop_bits(&mut self, val: u8) -> &mut Self {
179        self.set_stop_bits(val);
180        self
181    }
182}