web_webtransport_sys/gen/
gen_WebTransportErrorOptions.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 = WebTransportErrorOptions)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `WebTransportErrorOptions` dictionary."]
9    pub type WebTransportErrorOptions;
10}
11impl WebTransportErrorOptions {
12    #[doc = "Construct a new `WebTransportErrorOptions`."]
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 `source` field of this object."]
19    pub fn source(&mut self, val: WebTransportErrorSource) -> &mut Self {
20        use wasm_bindgen::JsValue;
21        let r =
22            ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("source"), &JsValue::from(val));
23        debug_assert!(
24            r.is_ok(),
25            "setting properties should never fail on our dictionary objects"
26        );
27        let _ = r;
28        self
29    }
30    #[doc = "Change the `streamErrorCode` field of this object."]
31    pub fn stream_error_code(&mut self, val: Option<u32>) -> &mut Self {
32        use wasm_bindgen::JsValue;
33        let r = ::js_sys::Reflect::set(
34            self.as_ref(),
35            &JsValue::from("streamErrorCode"),
36            &JsValue::from(val),
37        );
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 WebTransportErrorOptions {
47    fn default() -> Self {
48        Self::new()
49    }
50}