web_webtransport_sys/gen/
gen_WebTransportOptions.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 = WebTransportOptions)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `WebTransportOptions` dictionary."]
9    pub type WebTransportOptions;
10}
11impl WebTransportOptions {
12    #[doc = "Construct a new `WebTransportOptions`."]
13    pub fn new() -> Self {
14        #[allow(unused_mut)]
15        let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
16        ret
17    }
18    #[doc = "Change the `allowPooling` field of this object."]
19    pub fn allow_pooling(&mut self, val: bool) -> &mut Self {
20        use wasm_bindgen::JsValue;
21        let r = ::js_sys::Reflect::set(
22            self.as_ref(),
23            &JsValue::from("allowPooling"),
24            &JsValue::from(val),
25        );
26        debug_assert!(
27            r.is_ok(),
28            "setting properties should never fail on our dictionary objects"
29        );
30        let _ = r;
31        self
32    }
33    #[doc = "Change the `congestionControl` field of this object."]
34    pub fn congestion_control(&mut self, val: WebTransportCongestionControl) -> &mut Self {
35        use wasm_bindgen::JsValue;
36        let r = ::js_sys::Reflect::set(
37            self.as_ref(),
38            &JsValue::from("congestionControl"),
39            &JsValue::from(val),
40        );
41        debug_assert!(
42            r.is_ok(),
43            "setting properties should never fail on our dictionary objects"
44        );
45        let _ = r;
46        self
47    }
48    #[doc = "Change the `requireUnreliable` field of this object."]
49    pub fn require_unreliable(&mut self, val: bool) -> &mut Self {
50        use wasm_bindgen::JsValue;
51        let r = ::js_sys::Reflect::set(
52            self.as_ref(),
53            &JsValue::from("requireUnreliable"),
54            &JsValue::from(val),
55        );
56        debug_assert!(
57            r.is_ok(),
58            "setting properties should never fail on our dictionary objects"
59        );
60        let _ = r;
61        self
62    }
63    #[doc = "Change the `serverCertificateHashes` field of this object."]
64    pub fn server_certificate_hashes(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
65        use wasm_bindgen::JsValue;
66        let r = ::js_sys::Reflect::set(
67            self.as_ref(),
68            &JsValue::from("serverCertificateHashes"),
69            &JsValue::from(val),
70        );
71        debug_assert!(
72            r.is_ok(),
73            "setting properties should never fail on our dictionary objects"
74        );
75        let _ = r;
76        self
77    }
78}
79impl Default for WebTransportOptions {
80    fn default() -> Self {
81        Self::new()
82    }
83}