blob: 4ba727c4a9c24bbd730550efa4c456851e6023c1 [file] [log] [blame]
#![allow(unused_imports)]
use super::*;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = UDPOptions)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `UdpOptions` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
pub type UdpOptions;
}
impl UdpOptions {
#[doc = "Construct a new `UdpOptions`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
pub fn new() -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret
}
#[doc = "Change the `addressReuse` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
pub fn address_reuse(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("addressReuse"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `localAddress` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
pub fn local_address(&mut self, val: &str) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("localAddress"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `localPort` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
pub fn local_port(&mut self, val: u16) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("localPort"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `loopback` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
pub fn loopback(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("loopback"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `remoteAddress` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
pub fn remote_address(&mut self, val: &str) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("remoteAddress"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[doc = "Change the `remotePort` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `UdpOptions`*"]
pub fn remote_port(&mut self, val: u16) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("remotePort"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
}
impl Default for UdpOptions {
fn default() -> Self {
Self::new()
}
}