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
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
use js_sys::JsString;
use wasm_bindgen::prelude::*;

#[wasm_bindgen]
#[derive(Clone, Debug, Default, PartialEq)]
pub struct CreateWriteStreamOptions {
    auto_close: Option<bool>,
    emit_close: Option<bool>,
    encoding: Option<JsString>,
    fd: Option<u32>,
    flags: Option<JsString>,
    mode: Option<u32>,
    start: Option<f64>,
}

#[wasm_bindgen]
impl CreateWriteStreamOptions {
    #[wasm_bindgen(constructor)]
    pub fn new_with_values(
        auto_close: Option<bool>,
        emit_close: Option<bool>,
        encoding: Option<JsString>,
        fd: Option<u32>,
        flags: Option<JsString>,
        mode: Option<u32>,
        start: Option<f64>,
    ) -> CreateWriteStreamOptions {
        CreateWriteStreamOptions {
            auto_close,
            emit_close,
            encoding,
            fd,
            flags,
            mode,
            start,
        }
    }

    #[wasm_bindgen(getter)]
    pub fn auto_close(&self) -> Option<bool> {
        self.auto_close
    }

    #[wasm_bindgen(setter)]
    pub fn set_auto_close(&mut self, value: Option<bool>) {
        self.auto_close = value;
    }

    #[wasm_bindgen(getter)]
    pub fn emit_close(&self) -> Option<bool> {
        self.emit_close
    }

    #[wasm_bindgen(setter)]
    pub fn set_emit_close(&mut self, value: Option<bool>) {
        self.emit_close = value;
    }

    #[wasm_bindgen(getter)]
    pub fn encoding(&self) -> Option<JsString> {
        self.encoding.clone()
    }

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

    #[wasm_bindgen(getter)]
    pub fn fd(&self) -> Option<u32> {
        self.fd
    }

    #[wasm_bindgen(setter)]
    pub fn set_fd(&mut self, value: Option<u32>) {
        self.fd = value;
    }

    #[wasm_bindgen(getter)]
    pub fn flags(&self) -> Option<JsString> {
        self.flags.clone()
    }

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

    #[wasm_bindgen(getter)]
    pub fn mode(&self) -> Option<u32> {
        self.mode
    }

    #[wasm_bindgen(setter)]
    pub fn set_mode(&mut self, value: Option<u32>) {
        self.mode = value;
    }

    #[wasm_bindgen(getter)]
    pub fn start(&self) -> Option<f64> {
        self.start
    }

    #[wasm_bindgen(setter)]
    pub fn set_start(&mut self, value: Option<f64>) {
        self.start = value;
    }
}