1 #![allow(unused_imports)] 2 use super::*; 3 use wasm_bindgen::prelude::*; 4 #[wasm_bindgen] 5 extern "C" { 6 # [wasm_bindgen (extends = :: js_sys :: Object , js_name = RTCDataChannelInit)] 7 #[derive(Debug, Clone, PartialEq, Eq)] 8 #[doc = "The `RtcDataChannelInit` dictionary."] 9 #[doc = ""] 10 #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] 11 pub type RtcDataChannelInit; 12 } 13 impl RtcDataChannelInit { 14 #[doc = "Construct a new `RtcDataChannelInit`."] 15 #[doc = ""] 16 #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] new() -> Self17 pub fn new() -> Self { 18 #[allow(unused_mut)] 19 let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); 20 ret 21 } 22 #[doc = "Change the `id` field of this object."] 23 #[doc = ""] 24 #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] id(&mut self, val: u16) -> &mut Self25 pub fn id(&mut self, val: u16) -> &mut Self { 26 use wasm_bindgen::JsValue; 27 let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("id"), &JsValue::from(val)); 28 debug_assert!( 29 r.is_ok(), 30 "setting properties should never fail on our dictionary objects" 31 ); 32 let _ = r; 33 self 34 } 35 #[doc = "Change the `maxPacketLifeTime` field of this object."] 36 #[doc = ""] 37 #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] max_packet_life_time(&mut self, val: u16) -> &mut Self38 pub fn max_packet_life_time(&mut self, val: u16) -> &mut Self { 39 use wasm_bindgen::JsValue; 40 let r = ::js_sys::Reflect::set( 41 self.as_ref(), 42 &JsValue::from("maxPacketLifeTime"), 43 &JsValue::from(val), 44 ); 45 debug_assert!( 46 r.is_ok(), 47 "setting properties should never fail on our dictionary objects" 48 ); 49 let _ = r; 50 self 51 } 52 #[doc = "Change the `maxRetransmitTime` field of this object."] 53 #[doc = ""] 54 #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] max_retransmit_time(&mut self, val: u16) -> &mut Self55 pub fn max_retransmit_time(&mut self, val: u16) -> &mut Self { 56 use wasm_bindgen::JsValue; 57 let r = ::js_sys::Reflect::set( 58 self.as_ref(), 59 &JsValue::from("maxRetransmitTime"), 60 &JsValue::from(val), 61 ); 62 debug_assert!( 63 r.is_ok(), 64 "setting properties should never fail on our dictionary objects" 65 ); 66 let _ = r; 67 self 68 } 69 #[doc = "Change the `maxRetransmits` field of this object."] 70 #[doc = ""] 71 #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] max_retransmits(&mut self, val: u16) -> &mut Self72 pub fn max_retransmits(&mut self, val: u16) -> &mut Self { 73 use wasm_bindgen::JsValue; 74 let r = ::js_sys::Reflect::set( 75 self.as_ref(), 76 &JsValue::from("maxRetransmits"), 77 &JsValue::from(val), 78 ); 79 debug_assert!( 80 r.is_ok(), 81 "setting properties should never fail on our dictionary objects" 82 ); 83 let _ = r; 84 self 85 } 86 #[doc = "Change the `negotiated` field of this object."] 87 #[doc = ""] 88 #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] negotiated(&mut self, val: bool) -> &mut Self89 pub fn negotiated(&mut self, val: bool) -> &mut Self { 90 use wasm_bindgen::JsValue; 91 let r = ::js_sys::Reflect::set( 92 self.as_ref(), 93 &JsValue::from("negotiated"), 94 &JsValue::from(val), 95 ); 96 debug_assert!( 97 r.is_ok(), 98 "setting properties should never fail on our dictionary objects" 99 ); 100 let _ = r; 101 self 102 } 103 #[doc = "Change the `ordered` field of this object."] 104 #[doc = ""] 105 #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] ordered(&mut self, val: bool) -> &mut Self106 pub fn ordered(&mut self, val: bool) -> &mut Self { 107 use wasm_bindgen::JsValue; 108 let r = ::js_sys::Reflect::set( 109 self.as_ref(), 110 &JsValue::from("ordered"), 111 &JsValue::from(val), 112 ); 113 debug_assert!( 114 r.is_ok(), 115 "setting properties should never fail on our dictionary objects" 116 ); 117 let _ = r; 118 self 119 } 120 #[doc = "Change the `protocol` field of this object."] 121 #[doc = ""] 122 #[doc = "*This API requires the following crate features to be activated: `RtcDataChannelInit`*"] protocol(&mut self, val: &str) -> &mut Self123 pub fn protocol(&mut self, val: &str) -> &mut Self { 124 use wasm_bindgen::JsValue; 125 let r = ::js_sys::Reflect::set( 126 self.as_ref(), 127 &JsValue::from("protocol"), 128 &JsValue::from(val), 129 ); 130 debug_assert!( 131 r.is_ok(), 132 "setting properties should never fail on our dictionary objects" 133 ); 134 let _ = r; 135 self 136 } 137 } 138 impl Default for RtcDataChannelInit { default() -> Self139 fn default() -> Self { 140 Self::new() 141 } 142 } 143