wasm_streams/readable/
sys.rs1use js_sys::{Array, Error, Object};
5use wasm_bindgen::prelude::*;
6pub use web_sys::ReadableByteStreamController;
7pub use web_sys::ReadableStream;
9pub use web_sys::ReadableStreamByobReader as ReadableStreamBYOBReader;
10pub use web_sys::ReadableStreamByobRequest as ReadableStreamBYOBRequest;
11pub use web_sys::ReadableStreamDefaultController;
12pub use web_sys::ReadableStreamDefaultReader;
13pub use web_sys::ReadableStreamGetReaderOptions;
14pub use web_sys::ReadableStreamReadResult;
15pub use web_sys::ReadableStreamReaderMode;
16pub use web_sys::ReadableStreamType;
17pub use web_sys::StreamPipeOptions as PipeOptions;
18
19use crate::queuing_strategy::sys::QueuingStrategy;
20use crate::readable::into_underlying_byte_source::IntoUnderlyingByteSource;
21use crate::readable::into_underlying_source::IntoUnderlyingSource;
22
23#[wasm_bindgen]
24extern "C" {
25 #[wasm_bindgen(js_name = ReadableStream, typescript_type = "ReadableStream")]
27 pub(crate) type ReadableStreamExt;
28
29 #[wasm_bindgen(constructor, js_class = ReadableStream)]
30 pub(crate) fn new_with_into_underlying_source(
31 source: IntoUnderlyingSource,
32 strategy: QueuingStrategy,
33 ) -> ReadableStreamExt;
34
35 #[wasm_bindgen(constructor, catch, js_class = ReadableStream)]
36 pub(crate) fn new_with_into_underlying_byte_source(
37 source: IntoUnderlyingByteSource,
38 ) -> Result<ReadableStreamExt, Error>;
39
40 #[wasm_bindgen(method, catch, js_class = ReadableStream, js_name = getReader)]
41 pub(crate) fn try_get_reader(this: &ReadableStreamExt) -> Result<Object, Error>;
42
43 #[wasm_bindgen(method, catch, js_class = ReadableStream, js_name = getReader)]
44 pub(crate) fn try_get_reader_with_options(
45 this: &ReadableStreamExt,
46 options: &ReadableStreamGetReaderOptions,
47 ) -> Result<Object, Error>;
48
49 #[wasm_bindgen(method, catch, js_class = ReadableStream, js_name = tee)]
50 pub(crate) fn try_tee(this: &ReadableStreamExt) -> Result<Array, Error>;
51
52 #[wasm_bindgen(catch, static_method_of = ReadableStreamExt, js_class = ReadableStream, js_name = from)]
53 pub(crate) fn from_async_iterable(async_iterable: &Object) -> Result<ReadableStreamExt, Error>;
54}
55
56#[wasm_bindgen]
57extern "C" {
58 pub(crate) type ReadableStreamReaderExt;
61
62 #[wasm_bindgen(method, catch, js_name = releaseLock)]
63 pub(crate) fn try_release_lock(this: &ReadableStreamReaderExt) -> Result<(), Error>;
64}