electron_sys/interface/
enable_network_emulation_options.rs

1use wasm_bindgen::prelude::*;
2
3#[wasm_bindgen]
4#[derive(Clone, Debug, Eq, PartialEq)]
5pub struct EnableNetworkEmulationOptions {
6    download_throughput: Option<u32>,
7    latency: Option<u32>,
8    offline: Option<bool>,
9    upload_throughput: Option<u32>,
10}
11
12#[wasm_bindgen]
13impl EnableNetworkEmulationOptions {
14    #[wasm_bindgen(constructor)]
15    pub fn new(
16        download_throughput: Option<u32>,
17        latency: Option<u32>,
18        offline: Option<bool>,
19        upload_throughput: Option<u32>,
20    ) -> EnableNetworkEmulationOptions {
21        EnableNetworkEmulationOptions {
22            download_throughput,
23            latency,
24            offline,
25            upload_throughput,
26        }
27    }
28
29    #[wasm_bindgen(getter, js_name = "downloadThroughput")]
30    pub fn download_throughput(&self) -> Option<u32> {
31        self.download_throughput
32    }
33
34    #[wasm_bindgen(setter)]
35    pub fn set_download_throughput(&mut self, value: Option<u32>) {
36        self.download_throughput = value;
37    }
38
39    #[wasm_bindgen(getter)]
40    pub fn latency(&self) -> Option<u32> {
41        self.latency
42    }
43
44    #[wasm_bindgen(setter)]
45    pub fn set_latency(&mut self, value: Option<u32>) {
46        self.latency = value;
47    }
48
49    #[wasm_bindgen(getter)]
50    pub fn offline(&self) -> Option<bool> {
51        self.offline
52    }
53
54    #[wasm_bindgen(setter)]
55    pub fn set_offline(&mut self, value: Option<bool>) {
56        self.offline = value;
57    }
58
59    #[wasm_bindgen(getter, js_name = "uploadThroughput")]
60    pub fn upload_throughput(&self) -> Option<u32> {
61        self.upload_throughput
62    }
63
64    #[wasm_bindgen(setter)]
65    pub fn set_upload_throughput(&mut self, value: Option<u32>) {
66        self.upload_throughput = value;
67    }
68}