1 #![allow(unused_imports)]
2 use super::*;
3 use wasm_bindgen::prelude::*;
4 #[wasm_bindgen]
5 extern "C" {
6     # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableWritablePair)]
7     #[derive(Debug, Clone, PartialEq, Eq)]
8     #[doc = "The `ReadableWritablePair` dictionary."]
9     #[doc = ""]
10     #[doc = "*This API requires the following crate features to be activated: `ReadableWritablePair`*"]
11     pub type ReadableWritablePair;
12 }
13 impl ReadableWritablePair {
14     #[cfg(web_sys_unstable_apis)]
15     #[cfg(all(feature = "ReadableStream", feature = "WritableStream",))]
16     #[doc = "Construct a new `ReadableWritablePair`."]
17     #[doc = ""]
18     #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableWritablePair`, `WritableStream`*"]
19     #[doc = ""]
20     #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
21     #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
new(readable: &ReadableStream, writable: &WritableStream) -> Self22     pub fn new(readable: &ReadableStream, writable: &WritableStream) -> Self {
23         #[allow(unused_mut)]
24         let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
25         ret.readable(readable);
26         ret.writable(writable);
27         ret
28     }
29     #[cfg(feature = "ReadableStream")]
30     #[doc = "Change the `readable` field of this object."]
31     #[doc = ""]
32     #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableWritablePair`*"]
readable(&mut self, val: &ReadableStream) -> &mut Self33     pub fn readable(&mut self, val: &ReadableStream) -> &mut Self {
34         use wasm_bindgen::JsValue;
35         let r = ::js_sys::Reflect::set(
36             self.as_ref(),
37             &JsValue::from("readable"),
38             &JsValue::from(val),
39         );
40         debug_assert!(
41             r.is_ok(),
42             "setting properties should never fail on our dictionary objects"
43         );
44         let _ = r;
45         self
46     }
47     #[cfg(web_sys_unstable_apis)]
48     #[cfg(feature = "WritableStream")]
49     #[doc = "Change the `writable` field of this object."]
50     #[doc = ""]
51     #[doc = "*This API requires the following crate features to be activated: `ReadableWritablePair`, `WritableStream`*"]
52     #[doc = ""]
53     #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
54     #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
writable(&mut self, val: &WritableStream) -> &mut Self55     pub fn writable(&mut self, val: &WritableStream) -> &mut Self {
56         use wasm_bindgen::JsValue;
57         let r = ::js_sys::Reflect::set(
58             self.as_ref(),
59             &JsValue::from("writable"),
60             &JsValue::from(val),
61         );
62         debug_assert!(
63             r.is_ok(),
64             "setting properties should never fail on our dictionary objects"
65         );
66         let _ = r;
67         self
68     }
69 }
70