web_webtransport_sys/gen/
gen_WebTransportConnectionStats.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 = WebTransportConnectionStats)]
7    #[derive(Debug, Clone, PartialEq, Eq)]
8    #[doc = "The `WebTransportConnectionStats` dictionary."]
9    pub type WebTransportConnectionStats;
10}
11impl WebTransportConnectionStats {
12    #[doc = "Construct a new `WebTransportConnectionStats`."]
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 `bytesLost` field of this object."]
19    pub fn bytes_lost(&mut self, val: f64) -> &mut Self {
20        use wasm_bindgen::JsValue;
21        let r = ::js_sys::Reflect::set(
22            self.as_ref(),
23            &JsValue::from("bytesLost"),
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 `bytesReceived` field of this object."]
34    pub fn bytes_received(&mut self, val: f64) -> &mut Self {
35        use wasm_bindgen::JsValue;
36        let r = ::js_sys::Reflect::set(
37            self.as_ref(),
38            &JsValue::from("bytesReceived"),
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 `bytesSent` field of this object."]
49    pub fn bytes_sent(&mut self, val: f64) -> &mut Self {
50        use wasm_bindgen::JsValue;
51        let r = ::js_sys::Reflect::set(
52            self.as_ref(),
53            &JsValue::from("bytesSent"),
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 `datagrams` field of this object."]
64    pub fn datagrams(&mut self, val: &WebTransportDatagramStats) -> &mut Self {
65        use wasm_bindgen::JsValue;
66        let r = ::js_sys::Reflect::set(
67            self.as_ref(),
68            &JsValue::from("datagrams"),
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    #[doc = "Change the `estimatedSendRate` field of this object."]
79    pub fn estimated_send_rate(&mut self, val: Option<f64>) -> &mut Self {
80        use wasm_bindgen::JsValue;
81        let r = ::js_sys::Reflect::set(
82            self.as_ref(),
83            &JsValue::from("estimatedSendRate"),
84            &JsValue::from(val),
85        );
86        debug_assert!(
87            r.is_ok(),
88            "setting properties should never fail on our dictionary objects"
89        );
90        let _ = r;
91        self
92    }
93    #[doc = "Change the `packetsLost` field of this object."]
94    pub fn packets_lost(&mut self, val: f64) -> &mut Self {
95        use wasm_bindgen::JsValue;
96        let r = ::js_sys::Reflect::set(
97            self.as_ref(),
98            &JsValue::from("packetsLost"),
99            &JsValue::from(val),
100        );
101        debug_assert!(
102            r.is_ok(),
103            "setting properties should never fail on our dictionary objects"
104        );
105        let _ = r;
106        self
107    }
108    #[doc = "Change the `packetsReceived` field of this object."]
109    pub fn packets_received(&mut self, val: f64) -> &mut Self {
110        use wasm_bindgen::JsValue;
111        let r = ::js_sys::Reflect::set(
112            self.as_ref(),
113            &JsValue::from("packetsReceived"),
114            &JsValue::from(val),
115        );
116        debug_assert!(
117            r.is_ok(),
118            "setting properties should never fail on our dictionary objects"
119        );
120        let _ = r;
121        self
122    }
123    #[doc = "Change the `packetsSent` field of this object."]
124    pub fn packets_sent(&mut self, val: f64) -> &mut Self {
125        use wasm_bindgen::JsValue;
126        let r = ::js_sys::Reflect::set(
127            self.as_ref(),
128            &JsValue::from("packetsSent"),
129            &JsValue::from(val),
130        );
131        debug_assert!(
132            r.is_ok(),
133            "setting properties should never fail on our dictionary objects"
134        );
135        let _ = r;
136        self
137    }
138}
139impl Default for WebTransportConnectionStats {
140    fn default() -> Self {
141        Self::new()
142    }
143}