web_webtransport_sys/gen/
gen_WebTransportCloseInfo.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 = WebTransportCloseInfo)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `WebTransportCloseInfo` dictionary."]
9    pub type WebTransportCloseInfo;
10}
11impl WebTransportCloseInfo {
12    #[doc = "Construct a new `WebTransportCloseInfo`."]
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 `closeCode` field of this object."]
19    pub fn close_code(&mut self, val: u32) -> &mut Self {
20        use wasm_bindgen::JsValue;
21        let r = ::js_sys::Reflect::set(
22            self.as_ref(),
23            &JsValue::from("closeCode"),
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 `reason` field of this object."]
34    pub fn reason(&mut self, val: &str) -> &mut Self {
35        use wasm_bindgen::JsValue;
36        let r =
37            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("reason"), &JsValue::from(val));
38        debug_assert!(
39            r.is_ok(),
40            "setting properties should never fail on our dictionary objects"
41        );
42        let _ = r;
43        self
44    }
45}
46impl Default for WebTransportCloseInfo {
47    fn default() -> Self {
48        Self::new()
49    }
50}