web_sys/features/
gen_SocketOptions.rs1#![allow(unused_imports)]
2#![allow(clippy::all)]
3use super::*;
4use wasm_bindgen::prelude::*;
5#[wasm_bindgen]
6extern "C" {
7 # [wasm_bindgen (extends = :: js_sys :: Object , js_name = SocketOptions)]
8 #[derive(Debug, Clone, PartialEq, Eq)]
9 #[doc = "The `SocketOptions` dictionary."]
10 #[doc = ""]
11 #[doc = "*This API requires the following crate features to be activated: `SocketOptions`*"]
12 pub type SocketOptions;
13 #[cfg(feature = "TcpSocketBinaryType")]
14 #[doc = "Get the `binaryType` field of this object."]
15 #[doc = ""]
16 #[doc = "*This API requires the following crate features to be activated: `SocketOptions`, `TcpSocketBinaryType`*"]
17 #[wasm_bindgen(method, getter = "binaryType")]
18 pub fn get_binary_type(this: &SocketOptions) -> Option<TcpSocketBinaryType>;
19 #[cfg(feature = "TcpSocketBinaryType")]
20 #[doc = "Change the `binaryType` field of this object."]
21 #[doc = ""]
22 #[doc = "*This API requires the following crate features to be activated: `SocketOptions`, `TcpSocketBinaryType`*"]
23 #[wasm_bindgen(method, setter = "binaryType")]
24 pub fn set_binary_type(this: &SocketOptions, val: TcpSocketBinaryType);
25 #[doc = "Get the `useSecureTransport` field of this object."]
26 #[doc = ""]
27 #[doc = "*This API requires the following crate features to be activated: `SocketOptions`*"]
28 #[wasm_bindgen(method, getter = "useSecureTransport")]
29 pub fn get_use_secure_transport(this: &SocketOptions) -> Option<bool>;
30 #[doc = "Change the `useSecureTransport` field of this object."]
31 #[doc = ""]
32 #[doc = "*This API requires the following crate features to be activated: `SocketOptions`*"]
33 #[wasm_bindgen(method, setter = "useSecureTransport")]
34 pub fn set_use_secure_transport(this: &SocketOptions, val: bool);
35}
36impl SocketOptions {
37 #[doc = "Construct a new `SocketOptions`."]
38 #[doc = ""]
39 #[doc = "*This API requires the following crate features to be activated: `SocketOptions`*"]
40 pub fn new() -> Self {
41 #[allow(unused_mut)]
42 let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
43 ret
44 }
45 #[cfg(feature = "TcpSocketBinaryType")]
46 #[deprecated = "Use `set_binary_type()` instead."]
47 pub fn binary_type(&mut self, val: TcpSocketBinaryType) -> &mut Self {
48 self.set_binary_type(val);
49 self
50 }
51 #[deprecated = "Use `set_use_secure_transport()` instead."]
52 pub fn use_secure_transport(&mut self, val: bool) -> &mut Self {
53 self.set_use_secure_transport(val);
54 self
55 }
56}
57impl Default for SocketOptions {
58 fn default() -> Self {
59 Self::new()
60 }
61}