maxcountryman_web_sys/features/
gen_RtcSessionDescriptionInit.rs

1#![allow(unused_imports)]
2use super::*;
3use wasm_bindgen::prelude::*;
4#[wasm_bindgen]
5extern "C" {
6    # [wasm_bindgen (extends = :: js_sys :: Object , js_name = RTCSessionDescriptionInit)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `RtcSessionDescriptionInit` dictionary."]
9    #[doc = ""]
10    #[doc = "*This API requires the following crate features to be activated: `RtcSessionDescriptionInit`*"]
11    pub type RtcSessionDescriptionInit;
12}
13impl RtcSessionDescriptionInit {
14    #[cfg(feature = "RtcSdpType")]
15    #[doc = "Construct a new `RtcSessionDescriptionInit`."]
16    #[doc = ""]
17    #[doc = "*This API requires the following crate features to be activated: `RtcSdpType`, `RtcSessionDescriptionInit`*"]
18    pub fn new(type_: RtcSdpType) -> Self {
19        #[allow(unused_mut)]
20        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
21        ret.type_(type_);
22        ret
23    }
24    #[doc = "Change the `sdp` field of this object."]
25    #[doc = ""]
26    #[doc = "*This API requires the following crate features to be activated: `RtcSessionDescriptionInit`*"]
27    pub fn sdp(&mut self, val: &str) -> &mut Self {
28        use wasm_bindgen::JsValue;
29        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("sdp"), &JsValue::from(val));
30        debug_assert!(
31            r.is_ok(),
32            "setting properties should never fail on our dictionary objects"
33        );
34        let _ = r;
35        self
36    }
37    #[cfg(feature = "RtcSdpType")]
38    #[doc = "Change the `type` field of this object."]
39    #[doc = ""]
40    #[doc = "*This API requires the following crate features to be activated: `RtcSdpType`, `RtcSessionDescriptionInit`*"]
41    pub fn type_(&mut self, val: RtcSdpType) -> &mut Self {
42        use wasm_bindgen::JsValue;
43        let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val));
44        debug_assert!(
45            r.is_ok(),
46            "setting properties should never fail on our dictionary objects"
47        );
48        let _ = r;
49        self
50    }
51}