web_sys/features/
gen_UdpOptions.rs

1#![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 = UDPOptions)]
8    #[derive(Debug, Clone, PartialEq, Eq)]
9    #[doc = "The `UdpOptions` dictionary."]
10    #[doc = ""]
11    #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
12    pub type UdpOptions;
13    #[doc = "Get the `addressReuse` field of this object."]
14    #[doc = ""]
15    #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
16    #[wasm_bindgen(method, getter = "addressReuse")]
17    pub fn get_address_reuse(this: &UdpOptions) -> Option<bool>;
18    #[doc = "Change the `addressReuse` field of this object."]
19    #[doc = ""]
20    #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
21    #[wasm_bindgen(method, setter = "addressReuse")]
22    pub fn set_address_reuse(this: &UdpOptions, val: bool);
23    #[doc = "Get the `localAddress` field of this object."]
24    #[doc = ""]
25    #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
26    #[wasm_bindgen(method, getter = "localAddress")]
27    pub fn get_local_address(this: &UdpOptions) -> Option<::alloc::string::String>;
28    #[doc = "Change the `localAddress` field of this object."]
29    #[doc = ""]
30    #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
31    #[wasm_bindgen(method, setter = "localAddress")]
32    pub fn set_local_address(this: &UdpOptions, val: &str);
33    #[doc = "Get the `localPort` field of this object."]
34    #[doc = ""]
35    #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
36    #[wasm_bindgen(method, getter = "localPort")]
37    pub fn get_local_port(this: &UdpOptions) -> Option<u16>;
38    #[doc = "Change the `localPort` field of this object."]
39    #[doc = ""]
40    #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
41    #[wasm_bindgen(method, setter = "localPort")]
42    pub fn set_local_port(this: &UdpOptions, val: u16);
43    #[doc = "Get the `loopback` field of this object."]
44    #[doc = ""]
45    #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
46    #[wasm_bindgen(method, getter = "loopback")]
47    pub fn get_loopback(this: &UdpOptions) -> Option<bool>;
48    #[doc = "Change the `loopback` field of this object."]
49    #[doc = ""]
50    #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
51    #[wasm_bindgen(method, setter = "loopback")]
52    pub fn set_loopback(this: &UdpOptions, val: bool);
53    #[doc = "Get the `remoteAddress` field of this object."]
54    #[doc = ""]
55    #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
56    #[wasm_bindgen(method, getter = "remoteAddress")]
57    pub fn get_remote_address(this: &UdpOptions) -> Option<::alloc::string::String>;
58    #[doc = "Change the `remoteAddress` field of this object."]
59    #[doc = ""]
60    #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
61    #[wasm_bindgen(method, setter = "remoteAddress")]
62    pub fn set_remote_address(this: &UdpOptions, val: &str);
63    #[doc = "Get the `remotePort` field of this object."]
64    #[doc = ""]
65    #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
66    #[wasm_bindgen(method, getter = "remotePort")]
67    pub fn get_remote_port(this: &UdpOptions) -> Option<u16>;
68    #[doc = "Change the `remotePort` field of this object."]
69    #[doc = ""]
70    #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
71    #[wasm_bindgen(method, setter = "remotePort")]
72    pub fn set_remote_port(this: &UdpOptions, val: u16);
73}
74impl UdpOptions {
75    #[doc = "Construct a new `UdpOptions`."]
76    #[doc = ""]
77    #[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
78    pub fn new() -> Self {
79        #[allow(unused_mut)]
80        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
81        ret
82    }
83    #[deprecated = "Use `set_address_reuse()` instead."]
84    pub fn address_reuse(&mut self, val: bool) -> &mut Self {
85        self.set_address_reuse(val);
86        self
87    }
88    #[deprecated = "Use `set_local_address()` instead."]
89    pub fn local_address(&mut self, val: &str) -> &mut Self {
90        self.set_local_address(val);
91        self
92    }
93    #[deprecated = "Use `set_local_port()` instead."]
94    pub fn local_port(&mut self, val: u16) -> &mut Self {
95        self.set_local_port(val);
96        self
97    }
98    #[deprecated = "Use `set_loopback()` instead."]
99    pub fn loopback(&mut self, val: bool) -> &mut Self {
100        self.set_loopback(val);
101        self
102    }
103    #[deprecated = "Use `set_remote_address()` instead."]
104    pub fn remote_address(&mut self, val: &str) -> &mut Self {
105        self.set_remote_address(val);
106        self
107    }
108    #[deprecated = "Use `set_remote_port()` instead."]
109    pub fn remote_port(&mut self, val: u16) -> &mut Self {
110        self.set_remote_port(val);
111        self
112    }
113}
114impl Default for UdpOptions {
115    fn default() -> Self {
116        Self::new()
117    }
118}