1 | #![allow (unused_imports)] |
2 | #![allow (clippy::all)] |
3 | use super::*; |
4 | use wasm_bindgen::prelude::*; |
5 | #[wasm_bindgen ] |
6 | extern "C" { |
7 | # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ReadableWritablePair)] |
8 | #[derive (Debug, Clone, PartialEq, Eq)] |
9 | #[doc = "The `ReadableWritablePair` dictionary." ] |
10 | #[doc = "" ] |
11 | #[doc = "*This API requires the following crate features to be activated: `ReadableWritablePair`*" ] |
12 | pub type ReadableWritablePair; |
13 | } |
14 | impl ReadableWritablePair { |
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 | pub fn new(readable: &ReadableStream, writable: &WritableStream) -> Self { |
20 | #[allow (unused_mut)] |
21 | let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); |
22 | ret.readable(readable); |
23 | ret.writable(writable); |
24 | ret |
25 | } |
26 | #[cfg (feature = "ReadableStream" )] |
27 | #[doc = "Change the `readable` field of this object." ] |
28 | #[doc = "" ] |
29 | #[doc = "*This API requires the following crate features to be activated: `ReadableStream`, `ReadableWritablePair`*" ] |
30 | pub fn readable(&mut self, val: &ReadableStream) -> &mut Self { |
31 | use wasm_bindgen::JsValue; |
32 | let r = ::js_sys::Reflect::set( |
33 | self.as_ref(), |
34 | &JsValue::from("readable" ), |
35 | &JsValue::from(val), |
36 | ); |
37 | debug_assert!( |
38 | r.is_ok(), |
39 | "setting properties should never fail on our dictionary objects" |
40 | ); |
41 | let _ = r; |
42 | self |
43 | } |
44 | #[cfg (feature = "WritableStream" )] |
45 | #[doc = "Change the `writable` field of this object." ] |
46 | #[doc = "" ] |
47 | #[doc = "*This API requires the following crate features to be activated: `ReadableWritablePair`, `WritableStream`*" ] |
48 | pub fn writable(&mut self, val: &WritableStream) -> &mut Self { |
49 | use wasm_bindgen::JsValue; |
50 | let r = ::js_sys::Reflect::set( |
51 | self.as_ref(), |
52 | &JsValue::from("writable" ), |
53 | &JsValue::from(val), |
54 | ); |
55 | debug_assert!( |
56 | r.is_ok(), |
57 | "setting properties should never fail on our dictionary objects" |
58 | ); |
59 | let _ = r; |
60 | self |
61 | } |
62 | } |
63 | |