1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use js_sys::JsString;
use wasm_bindgen::prelude::*;

#[wasm_bindgen]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct SetProxyOptions {
    pac_script: Option<JsString>,
    proxy_rules: Option<JsString>,
    proxy_bypass_rules: Option<JsString>,
}

#[wasm_bindgen]
impl SetProxyOptions {
    #[wasm_bindgen(constructor)]
    pub fn new(
        pac_script: Option<JsString>,
        proxy_rules: Option<JsString>,
        proxy_bypass_rules: Option<JsString>,
    ) -> SetProxyOptions {
        SetProxyOptions {
            pac_script,
            proxy_rules,
            proxy_bypass_rules,
        }
    }

    #[wasm_bindgen(getter, js_name = "pacScript")]
    pub fn pac_script(&self) -> Option<JsString> {
        self.pac_script.clone()
    }

    #[wasm_bindgen(setter)]
    pub fn set_pac_script(&mut self, value: Option<JsString>) {
        self.pac_script = value;
    }

    #[wasm_bindgen(getter, js_name = "proxyRules")]
    pub fn proxy_rules(&self) -> Option<JsString> {
        self.proxy_rules.clone()
    }

    #[wasm_bindgen(setter)]
    pub fn set_proxy_rules(&mut self, value: Option<JsString>) {
        self.proxy_rules = value;
    }

    #[wasm_bindgen(getter, js_name = "proxyBypassRules")]
    pub fn proxy_bypass_rules(&self) -> Option<JsString> {
        self.proxy_bypass_rules.clone()
    }

    #[wasm_bindgen(setter)]
    pub fn set_proxy_bypass_rules(&mut self, value: Option<JsString>) {
        self.proxy_bypass_rules = value;
    }
}