commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
9228c4bba8cde80f8ebeaa04fc479e1fd63ced8b | Mattias Buelens | 2020-06-06T10:16:07 | Simplify test for aborting a read | diff --git a/tests/readable_stream.rs b/tests/readable_stream.rs
index 24d31ba..a53b8ef 100644
--- a/tests/readable_stream.rs
+++ b/tests/readable_stream.rs
@@ -1,6 +1,5 @@
use std::pin::Pin;
-use futures::future::{abortable, join, Aborted};
use futures::stream::{iter, StreamExt};
use wasm_bindgen::prelude::*;
us... | 1 | 11 | 11 |
d4945e0292d1ca133b3a0c48daa9b92fb4702614 | Mattias Buelens | 2020-06-06T10:08:31 | Call underlying read/write/cancel/abort method immediately
If the returned future is never polled, then previously the method would never be called.
Now, the method is called first, and then a future is returned. | diff --git a/src/readable/mod.rs b/src/readable/mod.rs
index cba2b93..756ac9d 100644
--- a/src/readable/mod.rs
+++ b/src/readable/mod.rs
@@ -1,5 +1,6 @@
//! Bindings and conversions for
//! [readable streams](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).
+use std::future::Future;
use std::marker:... | 2 | 94 | 47 |
f895e27a8f20347a57ecb29ebdca735301fc008a | Mattias Buelens | 2020-06-05T21:52:59 | Simplify tests for Unpin | diff --git a/Cargo.toml b/Cargo.toml
index 65082b5..2635bd4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,7 +19,6 @@ pin-utils = "^0.1.0"
[dev-dependencies]
wasm-bindgen-test = "0.3.13"
-assert-impl = "^0.1.3"
tokio = { version = "^0.2", features = ["macros"] }
[dev-dependencies.web-sys]
diff --git a/tests/re... | 3 | 12 | 5 |
e0b66dce2e25e70196ab7823906101fccbb70a47 | Mattias Buelens | 2020-06-05T21:44:57 | Tweak example | diff --git a/examples/fetch_as_stream.rs b/examples/fetch_as_stream.rs
index b186f4e..a9b31f2 100644
--- a/examples/fetch_as_stream.rs
+++ b/examples/fetch_as_stream.rs
@@ -2,7 +2,9 @@
//!
//! This example makes an HTTP request using `fetch()` from `web-sys`,
//! and then consumes the response body as a Rust `Stre... | 1 | 8 | 6 |
99c70ccdc81b0511b82d902931731e7c0f3fb031 | Mattias Buelens | 2020-06-05T21:35:51 | Fix example | diff --git a/Cargo.toml b/Cargo.toml
index a5567d5..65082b5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,6 +20,7 @@ pin-utils = "^0.1.0"
[dev-dependencies]
wasm-bindgen-test = "0.3.13"
assert-impl = "^0.1.3"
+tokio = { version = "^0.2", features = ["macros"] }
[dev-dependencies.web-sys]
version = "^0.3.40"
di... | 2 | 6 | 1 |
67c796ea3578d611e116bf53345c9470068c2d47 | Mattias Buelens | 2020-06-05T21:26:03 | Move fetch example to separate file | diff --git a/examples/fetch_as_stream.rs b/examples/fetch_as_stream.rs
new file mode 100644
index 0000000..0c18ec0
--- /dev/null
+++ b/examples/fetch_as_stream.rs
@@ -0,0 +1,31 @@
+//! ## Reading a streaming fetch response
+//!
+//! This example makes an HTTP request using `fetch()` from `web-sys`,
+//! and then con... | 2 | 31 | 32 |
e5c322a9c5bc5c35dd1cc2942ad0b28b9066cd18 | Mattias Buelens | 2020-06-05T20:43:10 | Fix clippy warnings | diff --git a/src/readable/into_underlying_source.rs b/src/readable/into_underlying_source.rs
index 18d7bce..77d3175 100644
--- a/src/readable/into_underlying_source.rs
+++ b/src/readable/into_underlying_source.rs
@@ -9,6 +9,8 @@ use wasm_bindgen_futures::spawn_local;
use super::sys;
+type JsValueStream = dyn St... | 2 | 6 | 4 |
18a88045120ca79be9e56581971e398487d90bb8 | Mattias Buelens | 2020-06-04T22:51:01 | Assert that IntoStream/Sink is Unpin | diff --git a/Cargo.toml b/Cargo.toml
index 4489e37..a5567d5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,6 +19,7 @@ pin-utils = "^0.1.0"
[dev-dependencies]
wasm-bindgen-test = "0.3.13"
+assert-impl = "^0.1.3"
[dev-dependencies.web-sys]
version = "^0.3.40"
diff --git a/tests/readable_stream.rs b/tests/readabl... | 3 | 13 | 0 |
f781d8bdfddc0b77dca4e3b7834d70e03afdad5b | Mattias Buelens | 2020-06-04T22:41:36 | Document crate with fetch example | diff --git a/Cargo.toml b/Cargo.toml
index 54406cd..4489e37 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,3 +19,12 @@ pin-utils = "^0.1.0"
[dev-dependencies]
wasm-bindgen-test = "0.3.13"
+
+[dev-dependencies.web-sys]
+version = "^0.3.40"
+features = [
+ "console",
+ "Response",
+ "ReadableStream",
+ "... | 2 | 49 | 0 |
8f4813078f62a632d3ac83ee9fce5ec72f5e550b | Mattias Buelens | 2020-06-04T22:21:20 | Remove unneeded pin_mut
Stream/Sink from into_stream/sink is Unpin, apparently. | diff --git a/tests/readable_stream.rs b/tests/readable_stream.rs
index af30aba..d7f3439 100644
--- a/tests/readable_stream.rs
+++ b/tests/readable_stream.rs
@@ -1,6 +1,5 @@
use futures::future::{abortable, join, Aborted};
use futures::stream::{iter, StreamExt};
-use pin_utils::pin_mut;
use wasm_bindgen::prelude::*;
... | 2 | 5 | 12 |
67e63d32ca4072111fa223abcc4bc78608c81214 | Mattias Buelens | 2020-06-03T22:44:06 | Add re-exports | diff --git a/src/lib.rs b/src/lib.rs
index 6d7a145..5e95a4b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,3 +2,7 @@ pub(crate) mod queuing_strategy;
pub mod readable;
pub mod transform;
pub mod writable;
+
+pub use readable::ReadableStream;
+pub use transform::TransformStream;
+pub use writable::WritableStream;
dif... | 2 | 6 | 2 |
2e3ad67fb3691696584e126754a3372800323b2d | Mattias Buelens | 2020-06-03T22:41:18 | Document transform streams | diff --git a/src/transform/mod.rs b/src/transform/mod.rs
index 3880d00..bef110f 100644
--- a/src/transform/mod.rs
+++ b/src/transform/mod.rs
@@ -1,33 +1,50 @@
+//! Bindings and conversions for
+//! [transform streams](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream).
use crate::readable::ReadableStrea... | 2 | 20 | 0 |
6734945f072ac01562e040fedddcc76404c21679 | Mattias Buelens | 2020-06-02T22:53:16 | Flip order in into_stream/sink error type | diff --git a/src/readable/mod.rs b/src/readable/mod.rs
index ac1bc88..cba2b93 100644
--- a/src/readable/mod.rs
+++ b/src/readable/mod.rs
@@ -115,10 +115,10 @@ impl ReadableStream {
///
/// If the stream is already locked to a reader, then this returns an error
/// along with the original `ReadableStream`... | 2 | 4 | 4 |
8c03a004cbbe960775c9ea9428aa6427a5638e49 | Mattias Buelens | 2020-06-02T22:51:30 | Document writable streams | diff --git a/src/readable/mod.rs b/src/readable/mod.rs
index 227aed2..ac1bc88 100644
--- a/src/readable/mod.rs
+++ b/src/readable/mod.rs
@@ -94,7 +94,7 @@ impl ReadableStream {
}
/// Creates a [default reader](ReadableStreamDefaultReader) and
- /// [locks](https://streams.spec.whatwg.org/#lock) the strea... | 4 | 130 | 4 |
d11aaa4f71b7400e5e8a1986610144a9fb6b9ab3 | Mattias Buelens | 2020-06-01T14:09:44 | Clean up imports | diff --git a/src/readable/mod.rs b/src/readable/mod.rs
index 78e469e..227aed2 100644
--- a/src/readable/mod.rs
+++ b/src/readable/mod.rs
@@ -2,7 +2,7 @@
//! [readable streams](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).
use std::marker::PhantomData;
-use futures::stream::{Stream, StreamExt, Tr... | 1 | 5 | 5 |
1f3c2db3e93f32a835e496d8b843ee7ac6db2ecd | Mattias Buelens | 2020-06-01T14:04:29 | Use explicit from_stream/sink in tests | diff --git a/tests/readable_stream.rs b/tests/readable_stream.rs
index ab3713f..af30aba 100644
--- a/tests/readable_stream.rs
+++ b/tests/readable_stream.rs
@@ -71,7 +71,7 @@ async fn test_readable_stream_reader_into_stream() {
#[wasm_bindgen_test]
async fn test_readable_stream_from_stream() {
let stream = iter(... | 2 | 6 | 6 |
aa50fb723b27f85aae323c42eaf54a5ece06ba02 | Mattias Buelens | 2020-06-01T14:03:00 | Add WritableStream::from_sink | diff --git a/src/writable/mod.rs b/src/writable/mod.rs
index 746ed25..3f80178 100644
--- a/src/writable/mod.rs
+++ b/src/writable/mod.rs
@@ -23,6 +23,17 @@ impl WritableStream {
Self { raw }
}
+ pub fn from_sink<Si>(sink: Si) -> Self
+ where
+ Si: Sink<JsValue, Error = JsValue> + 'static,
+... | 1 | 13 | 5 |
8328d211d311089d356fbc0e48e593dad45e22a8 | Mattias Buelens | 2020-06-01T14:00:57 | Document readable streams | diff --git a/src/readable/into_stream.rs b/src/readable/into_stream.rs
index fee35f2..2445a55 100644
--- a/src/readable/into_stream.rs
+++ b/src/readable/into_stream.rs
@@ -11,6 +11,11 @@ use wasm_bindgen_futures::JsFuture;
use super::sys::ReadableStreamReadResult;
use super::ReadableStreamDefaultReader;
+/// A [`S... | 3 | 101 | 1 |
932044aee7a77ec3a35d20f14db6bf9205d91a84 | Mattias Buelens | 2020-06-01T12:19:38 | Return original stream when into_stream/sink fails | diff --git a/src/readable/mod.rs b/src/readable/mod.rs
index b236ed1..ae972db 100644
--- a/src/readable/mod.rs
+++ b/src/readable/mod.rs
@@ -69,9 +69,13 @@ impl ReadableStream {
})
}
- pub fn into_stream(self) -> Result<IntoStream<'static>, JsValue> {
+ pub fn into_stream(self) -> Result<IntoStrea... | 2 | 12 | 4 |
5f57bc385cacfd849593b2d79bfc5a998b42c411 | Mattias Buelens | 2020-06-01T12:03:34 | Add ReadableStream::from_stream | diff --git a/src/readable/mod.rs b/src/readable/mod.rs
index d1452c2..b236ed1 100644
--- a/src/readable/mod.rs
+++ b/src/readable/mod.rs
@@ -24,6 +24,18 @@ impl ReadableStream {
Self { raw }
}
+ pub fn from_stream<S>(stream: S) -> Self
+ where
+ S: Stream<Item = Result<JsValue, JsValue>> + ... | 1 | 14 | 6 |
9b98be4f1916c31f1ca5c8f721907465206f128d | Mattias Buelens | 2020-06-01T10:58:35 | Add some Debug derives | diff --git a/src/queuing_strategy/mod.rs b/src/queuing_strategy/mod.rs
index 13ba02e..26810a4 100644
--- a/src/queuing_strategy/mod.rs
+++ b/src/queuing_strategy/mod.rs
@@ -1,6 +1,7 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
+#[derive(Debug)]
pub(crate) struct QueuingStrategy {
high_water_mark: f64... | 6 | 8 | 0 |
6cc5256d1f39ca3be60c056fc0fb441e258f502a | Mattias Buelens | 2020-05-31T21:51:20 | Update crate details | diff --git a/Cargo.toml b/Cargo.toml
index 56ed570..54406cd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,8 +3,12 @@ name = "wasm-streams"
version = "0.1.0"
authors = ["Mattias Buelens <mattias@buelens.com>"]
edition = "2018"
-
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/mani... | 1 | 6 | 2 |
e2d97eb6c55a3d31ced67a00d256e703fee4c9a0 | Mattias Buelens | 2020-05-31T20:33:51 | Update dependencies | diff --git a/Cargo.toml b/Cargo.toml
index 8d76b1e..56ed570 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,11 +7,11 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-js-sys = "^0.3.39"
-wasm-bindgen = "0.2.62"
-wasm-bindgen-futures =... | 1 | 4 | 4 |
3a2e4b63850a994f029dc111f2e929e7dfa24ca0 | Mattias Buelens | 2020-05-31T20:33:44 | Add tests for chaining {from/to}_{stream/sink} | diff --git a/tests/readable_stream.rs b/tests/readable_stream.rs
index 564ed66..ab3713f 100644
--- a/tests/readable_stream.rs
+++ b/tests/readable_stream.rs
@@ -119,3 +119,31 @@ async fn test_readable_stream_abort_read() {
// Must cancel any pending reads before releasing the reader's lock
reader.cancel().awa... | 2 | 45 | 0 |
c8e45a6cee9b8da7dc815e298f4917d5af3b46b4 | Mattias Buelens | 2020-05-31T20:06:07 | Elide some lifetimes | diff --git a/src/readable/mod.rs b/src/readable/mod.rs
index bddbf1e..bc15c57 100644
--- a/src/readable/mod.rs
+++ b/src/readable/mod.rs
@@ -49,7 +49,7 @@ impl ReadableStream {
Ok(())
}
- pub fn get_reader(&mut self) -> Result<ReadableStreamDefaultReader<'_>, JsValue> {
+ pub fn get_reader(&mut se... | 2 | 2 | 2 |
a6a70008023cdd8aedb4c849752b00749e23df51 | Mattias Buelens | 2020-05-23T23:01:03 | Add into_stream/sink directly to Readable/WritableStream | diff --git a/src/readable/mod.rs b/src/readable/mod.rs
index c86c813..bddbf1e 100644
--- a/src/readable/mod.rs
+++ b/src/readable/mod.rs
@@ -55,6 +55,14 @@ impl ReadableStream {
_stream: PhantomData,
})
}
+
+ pub fn into_stream(self) -> Result<IntoStream<'static>, JsValue> {
+ let r... | 4 | 73 | 6 |
03483b254f072c49fe0251ea6497eeda36b25edb | Mattias Buelens | 2020-05-23T22:30:42 | Tweak visibility | diff --git a/src/queuing_strategy/mod.rs b/src/queuing_strategy/mod.rs
index b55a070..13ba02e 100644
--- a/src/queuing_strategy/mod.rs
+++ b/src/queuing_strategy/mod.rs
@@ -1,7 +1,7 @@
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
-pub struct QueuingStrategy {
+pub(crate) struct QueuingStrategy {
high_wat... | 1 | 1 | 1 |
fd74694c628cbe77dd0725d76aee58354fe467ab | Mattias Buelens | 2020-05-23T22:24:21 | Remove generics on inner structs for IntoUnderlyingSource/Sink | diff --git a/src/readable/into_underlying_source.rs b/src/readable/into_underlying_source.rs
index b805d55..18d7bce 100644
--- a/src/readable/into_underlying_source.rs
+++ b/src/readable/into_underlying_source.rs
@@ -11,14 +11,14 @@ use super::sys;
#[wasm_bindgen]
pub(crate) struct IntoUnderlyingSource {
- in... | 2 | 17 | 21 |
6803acb6158acd046dff4a5b26a4025fb6b4b8fe | Mattias Buelens | 2020-05-23T15:38:16 | Box stream/sink inside From implementation | diff --git a/src/readable/mod.rs b/src/readable/mod.rs
index 568e3d8..c86c813 100644
--- a/src/readable/mod.rs
+++ b/src/readable/mod.rs
@@ -57,9 +57,12 @@ impl ReadableStream {
}
}
-impl From<Box<dyn Stream<Item = Result<JsValue, JsValue>>>> for ReadableStream {
- fn from(stream: Box<dyn Stream<Item = Resul... | 4 | 16 | 13 |
4daed26e03cdb5435d42ec84a2e26576ea4e46ae | Mattias Buelens | 2020-05-23T15:30:18 | Simplify | diff --git a/tests/writable_stream.rs b/tests/writable_stream.rs
index 501a27c..5a624cf 100644
--- a/tests/writable_stream.rs
+++ b/tests/writable_stream.rs
@@ -42,17 +42,15 @@ async fn test_writable_stream_into_sink() {
#[wasm_bindgen_test]
async fn test_writable_stream_from_sink() {
let (sink, stream) = mpsc::... | 1 | 9 | 11 |
38fc502cdbf998566ac3c6eb334cb1b7808c8e5c | Mattias Buelens | 2020-05-23T15:23:09 | Use default queuing strategy for writable streams | diff --git a/src/writable/mod.rs b/src/writable/mod.rs
index a945bc7..127a935 100644
--- a/src/writable/mod.rs
+++ b/src/writable/mod.rs
@@ -6,7 +6,6 @@ use wasm_bindgen_futures::JsFuture;
pub use into_sink::IntoSink;
-use crate::queuing_strategy::QueuingStrategy;
use crate::writable::into_underlying_sink::IntoUn... | 2 | 4 | 11 |
21a5c67aec59af0235a4cf6efe95c959b7306d64 | Mattias Buelens | 2020-05-13T22:48:32 | Add test | diff --git a/tests/writable_stream.rs b/tests/writable_stream.rs
index acb0abf..501a27c 100644
--- a/tests/writable_stream.rs
+++ b/tests/writable_stream.rs
@@ -1,6 +1,7 @@
extern crate wasm_bindgen_test;
-use futures::sink::SinkExt;
+use futures::channel::*;
+use futures::{Sink, SinkExt, StreamExt};
use pin_utils:... | 1 | 24 | 1 |
74f863e9cd6fed0b07cc786456b0395e4e25649c | Mattias Buelens | 2020-05-13T22:20:21 | Create JS WritableStream from Rust Sink | diff --git a/src/writable/into_underlying_sink.rs b/src/writable/into_underlying_sink.rs
new file mode 100644
index 0000000..512c095
--- /dev/null
+++ b/src/writable/into_underlying_sink.rs
@@ -0,0 +1,87 @@
+use std::cell::RefCell;
+use std::pin::Pin;
+use std::rc::Rc;
+
+use futures::sink::{Sink, SinkExt};
+use j... | 3 | 113 | 0 |
d0c03d89cdbf7107e401aaf3081c0b02a7a0480f | Mattias Buelens | 2020-05-16T14:23:50 | Update dependencies | diff --git a/Cargo.toml b/Cargo.toml
index 6b11b2a..8d76b1e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,11 +7,11 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-js-sys = "0.3.33"
-wasm-bindgen = "0.2.56"
-wasm-bindgen-futures = ... | 1 | 6 | 6 |
99db63aff4c7641c7f1713aa433865838840d801 | Mattias Buelens | 2020-05-12T20:49:39 | Rename from to from_raw | diff --git a/src/readable/mod.rs b/src/readable/mod.rs
index da2e644..568e3d8 100644
--- a/src/readable/mod.rs
+++ b/src/readable/mod.rs
@@ -18,6 +18,11 @@ pub struct ReadableStream {
}
impl ReadableStream {
+ #[inline]
+ pub fn from_raw(raw: sys::ReadableStream) -> Self {
+ Self { raw }
+ }
+
... | 6 | 25 | 28 |
a4a742f317b245b2e23a92c1315d78adcefff44c | Mattias Buelens | 2020-01-03T21:06:51 | Tiny tweak | diff --git a/src/readable/into_underlying_source.rs b/src/readable/into_underlying_source.rs
index 5d9a6a5..b805d55 100644
--- a/src/readable/into_underlying_source.rs
+++ b/src/readable/into_underlying_source.rs
@@ -47,8 +47,11 @@ impl IntoUnderlyingSource {
// Since we run the future separately, we need to a... | 1 | 4 | 1 |
5fe6d270f696d226ca9ed0797cbac01bf829d5d0 | Mattias Buelens | 2020-01-03T20:56:28 | Set HWM to 0 when converting from Stream | diff --git a/src/readable/mod.rs b/src/readable/mod.rs
index 9a562f6..da2e644 100644
--- a/src/readable/mod.rs
+++ b/src/readable/mod.rs
@@ -61,7 +61,9 @@ impl From<sys::ReadableStream> for ReadableStream {
impl From<Box<dyn Stream<Item = Result<JsValue, JsValue>>>> for ReadableStream {
fn from(stream: Box<dyn St... | 1 | 3 | 1 |
c0437e15993cf14716974ed885e83348df769e6c | Mattias Buelens | 2020-01-03T20:55:16 | Add QueuingStrategy | diff --git a/src/lib.rs b/src/lib.rs
index 7fa4d9a..6d7a145 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +1,4 @@
+pub(crate) mod queuing_strategy;
pub mod readable;
pub mod transform;
pub mod writable;
diff --git a/src/queuing_strategy/mod.rs b/src/queuing_strategy/mod.rs
new file mode 100644
index 0000000..b55a... | 4 | 32 | 4 |
7ee4d5c68a4cfe1370a1ee4a987fa6508a04a6fd | Mattias Buelens | 2020-01-03T17:34:13 | Extract inner struct (again) | diff --git a/src/readable/into_underlying_source.rs b/src/readable/into_underlying_source.rs
index 3030bc3..5d9a6a5 100644
--- a/src/readable/into_underlying_source.rs
+++ b/src/readable/into_underlying_source.rs
@@ -11,14 +11,14 @@ use super::sys;
#[wasm_bindgen]
pub(crate) struct IntoUnderlyingSource {
- st... | 1 | 39 | 20 |
7bcf2a07e588c5dde0bcbba0517b46c9c141b10c | Mattias Buelens | 2020-01-02T11:46:12 | Use unwrap_throw | diff --git a/src/readable/into_underlying_source.rs b/src/readable/into_underlying_source.rs
index 63cfa64..3030bc3 100644
--- a/src/readable/into_underlying_source.rs
+++ b/src/readable/into_underlying_source.rs
@@ -31,7 +31,7 @@ impl IntoUnderlyingSource {
let fut = async move {
// This mutable... | 1 | 1 | 1 |
57ed7adca43aa28c881dc028f7635c3d7f2cd4b0 | Mattias Buelens | 2020-01-02T11:45:56 | Tweak comment | diff --git a/src/readable/into_underlying_source.rs b/src/readable/into_underlying_source.rs
index d109030..63cfa64 100644
--- a/src/readable/into_underlying_source.rs
+++ b/src/readable/into_underlying_source.rs
@@ -57,7 +57,10 @@ impl IntoUnderlyingSource {
// Therefore, we DO NOT return a promise from pull(... | 1 | 4 | 1 |
120f1d7ec2767dec2f98e2441005a52115ecbdb5 | Mattias Buelens | 2020-01-01T16:38:31 | Don't return a promise from pull | diff --git a/src/readable/into_underlying_source.rs b/src/readable/into_underlying_source.rs
index ccfa1c9..d109030 100644
--- a/src/readable/into_underlying_source.rs
+++ b/src/readable/into_underlying_source.rs
@@ -4,9 +4,8 @@ use std::rc::Rc;
use futures::future::{abortable, AbortHandle, TryFutureExt};
use fut... | 1 | 12 | 5 |
9e527536f2f69c6b351ea48ebc23bf9679a507a0 | Mattias Buelens | 2020-01-01T16:37:13 | Abort the pending pull on drop | diff --git a/src/readable/into_underlying_source.rs b/src/readable/into_underlying_source.rs
index 832b361..ccfa1c9 100644
--- a/src/readable/into_underlying_source.rs
+++ b/src/readable/into_underlying_source.rs
@@ -56,13 +56,17 @@ impl IntoUnderlyingSource {
future_to_promise(fut.unwrap_or_else(|_| Ok(JsValu... | 1 | 8 | 4 |
5b379c00de10ff4bef955b241754f9214e1d448f | Mattias Buelens | 2020-01-01T16:01:51 | Abort the pending pull on cancel | diff --git a/src/readable/into_underlying_source.rs b/src/readable/into_underlying_source.rs
index c17051a..832b361 100644
--- a/src/readable/into_underlying_source.rs
+++ b/src/readable/into_underlying_source.rs
@@ -2,6 +2,7 @@ use std::cell::RefCell;
use std::pin::Pin;
use std::rc::Rc;
+use futures::future::{a... | 1 | 18 | 7 |
06a486ed3f3fc1f2f81aa850c094cffff9e8627a | Mattias Buelens | 2020-01-01T15:32:26 | Drop the stream after it has been canceled | diff --git a/src/readable/into_underlying_source.rs b/src/readable/into_underlying_source.rs
index d65d2cd..c17051a 100644
--- a/src/readable/into_underlying_source.rs
+++ b/src/readable/into_underlying_source.rs
@@ -49,4 +49,9 @@ impl IntoUnderlyingSource {
Ok(JsValue::undefined())
})
}
+... | 2 | 17 | 0 |
169a35703f1fc42dd6a0bf698920fabfb42c53a0 | Mattias Buelens | 2020-01-01T15:13:12 | Use unwrap_throw instead of unwrap | diff --git a/src/readable/into_stream.rs b/src/readable/into_stream.rs
index 8cde30b..004656a 100644
--- a/src/readable/into_stream.rs
+++ b/src/readable/into_stream.rs
@@ -56,7 +56,7 @@ impl<'reader> Stream for IntoStream<'reader> {
}
// Poll the future for the pending read
- let js_result =... | 4 | 23 | 8 |
e1b0efc792e3832617d6769c6b420d392bdd0143 | Mattias Buelens | 2020-01-01T15:11:17 | Drop the stream after it has closed or errored | diff --git a/src/readable/into_underlying_source.rs b/src/readable/into_underlying_source.rs
index 56b8587..d65d2cd 100644
--- a/src/readable/into_underlying_source.rs
+++ b/src/readable/into_underlying_source.rs
@@ -11,13 +11,13 @@ use super::sys;
#[wasm_bindgen]
pub(crate) struct IntoUnderlyingSource {
- st... | 1 | 19 | 7 |
9faebffae509a3faa0466d28efdfacd63b9853d9 | Mattias Buelens | 2020-01-01T13:15:40 | Inline inner struct | diff --git a/src/readable/into_underlying_source.rs b/src/readable/into_underlying_source.rs
index daeecb0..56b8587 100644
--- a/src/readable/into_underlying_source.rs
+++ b/src/readable/into_underlying_source.rs
@@ -1,29 +1,23 @@
+use std::cell::RefCell;
use std::pin::Pin;
+use std::rc::Rc;
use futures::stream... | 1 | 12 | 27 |
c9d9fac54e90ab84229eefa4ec360d2cdc3faf83 | Mattias Buelens | 2020-01-01T13:10:35 | Update dependencies | diff --git a/Cargo.toml b/Cargo.toml
index 064f5e5..6b11b2a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,11 +7,11 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-js-sys = "0.3.31"
-wasm-bindgen = "0.2.54"
-wasm-bindgen-futures = ... | 1 | 4 | 4 |
1ba0fd8d7bfba832da6e2dadc31b33bd5ac26763 | Mattias Buelens | 2020-01-01T13:10:25 | Add From<Box<dyn Stream>> for ReadableStream | diff --git a/src/readable/into_underlying_source.rs b/src/readable/into_underlying_source.rs
new file mode 100644
index 0000000..daeecb0
--- /dev/null
+++ b/src/readable/into_underlying_source.rs
@@ -0,0 +1,55 @@
+use std::pin::Pin;
+
+use futures::stream::{Stream, TryStreamExt};
+use js_sys::Promise;
+use wasm_bin... | 4 | 103 | 1 |
95aa1dc6c4661e6f074e090ec51d21626d3ae690 | Mattias Buelens | 2020-01-01T11:49:00 | Re-order | diff --git a/src/readable/mod.rs b/src/readable/mod.rs
index 14482fd..9005f7c 100644
--- a/src/readable/mod.rs
+++ b/src/readable/mod.rs
@@ -18,6 +18,11 @@ impl ReadableStream {
&self.raw
}
+ #[inline]
+ pub fn into_raw(self) -> sys::ReadableStream {
+ self.raw
+ }
+
pub fn is_locke... | 3 | 15 | 12 |
1c54d3db42cd5c12644757be249db720ce74a055 | Mattias Buelens | 2019-12-30T12:20:37 | Rename forget to into_raw | diff --git a/src/readable/mod.rs b/src/readable/mod.rs
index 4772d0e..14482fd 100644
--- a/src/readable/mod.rs
+++ b/src/readable/mod.rs
@@ -41,7 +41,7 @@ impl ReadableStream {
})
}
- pub fn forget(self) -> sys::ReadableStream {
+ pub fn into_raw(self) -> sys::ReadableStream {
self.raw
... | 3 | 3 | 3 |
3d545fd3f58a3c5f1d581827a117219fd74c6c72 | Mattias Buelens | 2019-12-30T12:13:41 | Remove constructors | diff --git a/Cargo.toml b/Cargo.toml
index 7c6f80a..064f5e5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,7 +11,6 @@ js-sys = "0.3.31"
wasm-bindgen = "0.2.54"
wasm-bindgen-futures = "0.4.4"
futures = "0.3.1"
-async-trait = "0.1.17"
pin-utils = "0.1.0-alpha.4"
[dev-dependencies]
diff --git a/src/readable/mod.rs... | 7 | 5 | 610 |
11aef5ad91c364a4908ba8f4ec9560bc22417704 | Mattias Buelens | 2019-11-25T23:20:31 | Run cargo fmt | diff --git a/src/lib.rs b/src/lib.rs
index 602ab92..7fa4d9a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +1,3 @@
pub mod readable;
-pub mod writable;
pub mod transform;
+pub mod writable;
diff --git a/src/readable/into_stream.rs b/src/readable/into_stream.rs
index d21c860..8cde30b 100644
--- a/src/readable/into_s... | 13 | 195 | 132 |
5cdae447f135b65146f5e697b49cd09f0b80ec4a | Mattias Buelens | 2019-11-25T23:19:42 | Fix line endings | diff --git a/src/readable/into_stream.rs b/src/readable/into_stream.rs
index 74b78fb..d21c860 100644
--- a/src/readable/into_stream.rs
+++ b/src/readable/into_stream.rs
@@ -1,84 +1,84 @@
-use core::pin::Pin;
-
-use futures::future::Future;
-use futures::ready;
-use futures::stream::{FusedStream, Stream};
-use futu... | 3 | 413 | 413 |
61640965389674c75bb371b59113b5fdc2a0621e | Mattias Buelens | 2019-11-10T19:22:13 | Rename inner to raw | diff --git a/src/readable/mod.rs b/src/readable/mod.rs
index 816adb6..82e95c4 100644
--- a/src/readable/mod.rs
+++ b/src/readable/mod.rs
@@ -13,44 +13,44 @@ mod into_stream;
pub mod sys;
pub struct ReadableStream {
- inner: sys::ReadableStream,
+ raw: sys::ReadableStream,
_source: Option<JsUnderlyingSour... | 3 | 81 | 81 |
7a6477eae77fd480292e6b485b4f33fff7d05363 | Mattias Buelens | 2019-11-10T19:18:40 | Add wrappers for controllers | diff --git a/src/readable/mod.rs b/src/readable/mod.rs
index e980ea3..816adb6 100644
--- a/src/readable/mod.rs
+++ b/src/readable/mod.rs
@@ -8,7 +8,6 @@ use wasm_bindgen_futures::{future_to_promise, JsFuture};
use async_trait::async_trait;
pub use into_stream::IntoStream;
-pub use sys::ReadableStreamDefaultControll... | 3 | 121 | 31 |
107ff183a9f083bfc4b27f1946cc12ce0976d234 | Mattias Buelens | 2019-11-10T19:00:35 | Use wasm-bindgen prelude everywhere | diff --git a/src/readable/into_stream.rs b/src/readable/into_stream.rs
index ce5f6dc..74b78fb 100644
--- a/src/readable/into_stream.rs
+++ b/src/readable/into_stream.rs
@@ -5,7 +5,7 @@ use futures::ready;
use futures::stream::{FusedStream, Stream};
use futures::task::{Context, Poll};
use pin_utils::{unsafe_pinned,... | 5 | 5 | 8 |
e63dc3ead04de510c7b6da286495e3c589d8690a | Mattias Buelens | 2019-11-10T14:16:55 | Add transform streams | diff --git a/src/lib.rs b/src/lib.rs
index 5393aef..602ab92 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,2 +1,3 @@
pub mod readable;
pub mod writable;
+pub mod transform;
diff --git a/src/transform/mod.rs b/src/transform/mod.rs
new file mode 100644
index 0000000..c7b09d3
--- /dev/null
+++ b/src/transform/mod.rs
@@ ... | 5 | 268 | 0 |
b83a55e09603a0a8f1102ddf97b84a99ecff3495 | Mattias Buelens | 2019-11-10T14:13:50 | Convert from raw streams | diff --git a/src/readable/mod.rs b/src/readable/mod.rs
index a6e503a..5014591 100644
--- a/src/readable/mod.rs
+++ b/src/readable/mod.rs
@@ -16,7 +16,7 @@ pub mod sys;
pub struct ReadableStream {
inner: sys::ReadableStream,
- _source: JsUnderlyingSource,
+ _source: Option<JsUnderlyingSource>,
}
impl R... | 2 | 28 | 6 |
ee714272c4f5c4983f763880d12a87aa5a4db1de | Mattias Buelens | 2019-11-10T13:32:12 | Rename modules | diff --git a/src/lib.rs b/src/lib.rs
index adc8d8c..5393aef 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,2 +1,2 @@
-pub mod readable_stream;
-pub mod writable_stream;
+pub mod readable;
+pub mod writable;
diff --git a/src/readable_stream/into_stream.rs b/src/readable/into_stream.rs
similarity index 100%
rename from s... | 9 | 4 | 4 |
0bdb028f0ecb96dcee13816c13f1587590599f94 | Mattias Buelens | 2019-11-08T22:16:03 | Use sys::Xyz instead of RawXyz | diff --git a/src/readable_stream/mod.rs b/src/readable_stream/mod.rs
index 6d71eaf..a6e503a 100644
--- a/src/readable_stream/mod.rs
+++ b/src/readable_stream/mod.rs
@@ -9,26 +9,20 @@ use wasm_bindgen_futures::{future_to_promise, JsFuture};
use async_trait::async_trait;
pub use into_stream::IntoStream;
-use sys::{
-... | 2 | 21 | 32 |
43b80a4abf1d373f069ddcc14a94ea7d72e964c6 | Mattias Buelens | 2019-11-08T22:07:50 | Expose IntoStream and IntoSink types | diff --git a/src/readable_stream/into_stream.rs b/src/readable_stream/into_stream.rs
index d9c388e..ce5f6dc 100644
--- a/src/readable_stream/into_stream.rs
+++ b/src/readable_stream/into_stream.rs
@@ -11,13 +11,6 @@ use wasm_bindgen_futures::JsFuture;
use super::ReadableStreamDefaultReader;
use super::sys::ReadableS... | 4 | 24 | 24 |
41d3f5a9b04bb37788fc23898497642b5e421e3e | Mattias Buelens | 2019-11-08T21:27:18 | Use PhantomData to hold borrow | diff --git a/src/readable_stream/mod.rs b/src/readable_stream/mod.rs
index fac35d3..e612e71 100644
--- a/src/readable_stream/mod.rs
+++ b/src/readable_stream/mod.rs
@@ -1,4 +1,5 @@
use std::cell::RefCell;
+use std::marker::PhantomData;
use std::rc::Rc;
use futures::Stream;
@@ -59,7 +60,7 @@ impl ReadableStream {
... | 2 | 6 | 4 |
509a8e41be3338a8360e7b8f28a4e77fe86b7a95 | Mattias Buelens | 2019-11-08T21:17:19 | Add ConsoleSink for writable stream tests | diff --git a/tests/writable_stream.rs b/tests/writable_stream.rs
index 3859683..87d4daa 100644
--- a/tests/writable_stream.rs
+++ b/tests/writable_stream.rs
@@ -10,9 +10,23 @@ use wasm_streams::writable_stream::*;
struct NoopSink;
+struct ConsoleSink;
+
#[async_trait(? Send)]
impl UnderlyingSink for NoopSink {}
... | 1 | 15 | 1 |
ca262f1224d5cc0c29f28f7a842e8fc1d07347e2 | Mattias Buelens | 2019-11-08T21:10:01 | Fix code style | diff --git a/src/readable_stream/mod.rs b/src/readable_stream/mod.rs
index afee0e0..fac35d3 100644
--- a/src/readable_stream/mod.rs
+++ b/src/readable_stream/mod.rs
@@ -207,7 +207,7 @@ impl<'stream> ReadableStreamDefaultReader<'stream> {
Ok(())
}
- pub fn into_stream(self) -> impl Stream<Item=Result<... | 3 | 4 | 4 |
f5591efdfe51ee390718687b1b76dcbf40d29143 | Mattias Buelens | 2019-11-08T21:09:42 | Add writer.into_sink() | diff --git a/src/writable_stream/into_sink.rs b/src/writable_stream/into_sink.rs
new file mode 100644
index 0000000..54388e3
--- /dev/null
+++ b/src/writable_stream/into_sink.rs
@@ -0,0 +1,146 @@
+use core::pin::Pin;
+
+use futures::future::Future;
+use futures::ready;
+use futures::sink::Sink;
+use futures::task:... | 3 | 168 | 0 |
78d10ffdf1d6429b02830a0f53330ea8524b021a | Mattias Buelens | 2019-11-08T21:07:05 | Fix writer lifetime | diff --git a/src/writable_stream/mod.rs b/src/writable_stream/mod.rs
index fb95102..210372f 100644
--- a/src/writable_stream/mod.rs
+++ b/src/writable_stream/mod.rs
@@ -52,9 +52,10 @@ impl WritableStream {
Ok(())
}
- pub fn get_writer(&mut self) -> Result<WritableStreamDefaultWriter, JsValue> {
+ ... | 1 | 8 | 6 |
9f32a249598ecbedc2bfd07c3a21b4bb92e7f9e9 | Mattias Buelens | 2019-11-08T20:58:14 | Fix names | diff --git a/tests/writable_stream.rs b/tests/writable_stream.rs
index 6a41f8c..b3f023e 100644
--- a/tests/writable_stream.rs
+++ b/tests/writable_stream.rs
@@ -13,12 +13,12 @@ impl UnderlyingSink for NoopSink {}
#[wasm_bindgen_test]
async fn test_writable_stream_new() {
- let mut readable = WritableStream::new(... | 1 | 7 | 7 |
a0e7f37fb54b64a794f931a2d8c55c6ba499e379 | Mattias Buelens | 2019-11-08T20:51:24 | Fix reader lifetime
* Readable stream must outlive reader, so hold a reference to the stream in the reader
* Move into_stream to reader | diff --git a/src/readable_stream/into_stream.rs b/src/readable_stream/into_stream.rs
index e676b06..d9c388e 100644
--- a/src/readable_stream/into_stream.rs
+++ b/src/readable_stream/into_stream.rs
@@ -19,23 +19,23 @@ pub fn into_stream(reader: ReadableStreamDefaultReader) -> IntoStream {
}
#[must_use = "streams d... | 3 | 23 | 26 |
3d88036649cb2d582f528e0fd50e72ca86df1e92 | Mattias Buelens | 2019-11-08T00:09:57 | Update dependencies | diff --git a/Cargo.toml b/Cargo.toml
index ddb7e29..7c6f80a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,12 +7,12 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-js-sys = "0.3.28"
-wasm-bindgen = "0.2.51"
-wasm-bindgen-futures = ... | 1 | 5 | 5 |
99002b1e1302647e654f4498c07db9f26415e732 | Mattias Buelens | 2019-11-08T00:02:14 | Rework into_stream implementation | diff --git a/src/readable_stream/into_stream.rs b/src/readable_stream/into_stream.rs
index 3ed3a84..e676b06 100644
--- a/src/readable_stream/into_stream.rs
+++ b/src/readable_stream/into_stream.rs
@@ -1,4 +1,3 @@
-use core::fmt;
use core::pin::Pin;
use futures::future::Future;
@@ -6,78 +5,79 @@ use futures::rea... | 2 | 53 | 61 |
0651a7c30c4a248762cc95bdc3b4fc18c247f0d4 | Mattias Buelens | 2019-11-07T23:53:32 | Rename unfold to into_stream | diff --git a/src/readable_stream/unfold.rs b/src/readable_stream/into_stream.rs
similarity index 92%
rename from src/readable_stream/unfold.rs
rename to src/readable_stream/into_stream.rs
index 4d351ae..3ed3a84 100644
--- a/src/readable_stream/unfold.rs
+++ b/src/readable_stream/into_stream.rs
@@ -7,7 +7,7 @@ use futur... | 2 | 4 | 4 |
b10aefc88a0d6489ab0b80111723557084bf3054 | Mattias Buelens | 2019-11-07T23:05:56 | Copy futures::stream::unfold implementation | diff --git a/Cargo.toml b/Cargo.toml
index b6a4187..ddb7e29 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@ wasm-bindgen = "0.2.51"
wasm-bindgen-futures = "0.4.1"
futures = "0.3.0"
async-trait = "0.1.17"
+pin-utils = "0.1.0-alpha.4"
[dev-dependencies]
wasm-bindgen-test = "0.3.1"
-pin-utils = "0.1.0-al... | 3 | 86 | 2 |
39eadc23d76e187cfdc6b10bdcdfdd2757d250d7 | Mattias Buelens | 2019-11-06T22:56:38 | Add basic test for WritableStream | diff --git a/tests/mod.rs b/tests/mod.rs
index 063935d..95d3256 100644
--- a/tests/mod.rs
+++ b/tests/mod.rs
@@ -5,3 +5,4 @@ extern crate wasm_bindgen_test;
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
mod readable_stream;
+mod writable_stream;
diff --git a/tests/writable_stream.rs b/tests/writa... | 2 | 25 | 0 |
475717c0b4bc747da9ed1b84778b3c1707e441fb | Mattias Buelens | 2019-11-06T22:56:18 | Add tests mod | diff --git a/tests/mod.rs b/tests/mod.rs
new file mode 100644
index 0000000..063935d
--- /dev/null
+++ b/tests/mod.rs
@@ -0,0 +1,7 @@
+#![cfg(target_arch = "wasm32")]
+
+extern crate wasm_bindgen_test;
+
+wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
+
+mod readable_stream;
diff --git a/tests/readabl... | 2 | 7 | 6 |
7d88492d2135b80a6ea5a6c1b39ad447b6089f50 | Mattias Buelens | 2019-11-06T22:48:41 | Move tests for ReadableStream | diff --git a/tests/tests.rs b/tests/readable_stream.rs
similarity index 100%
rename from tests/tests.rs
rename to tests/readable_stream.rs | 1 | 0 | 0 |
99d0b1efd002dea4bd2fa36e2ae95497082faa1a | Mattias Buelens | 2019-11-06T22:48:24 | Add WritableStream | diff --git a/src/lib.rs b/src/lib.rs
index 81d5a23..adc8d8c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1 +1,2 @@
pub mod readable_stream;
+pub mod writable_stream;
diff --git a/src/writable_stream/mod.rs b/src/writable_stream/mod.rs
new file mode 100644
index 0000000..fb95102
--- /dev/null
+++ b/src/writable_stream/... | 3 | 325 | 0 |
0756ca54a6ed5d0f6e9bc5c288a97d8c7a84319e | Mattias Buelens | 2019-11-06T22:38:11 | Fix typo | diff --git a/src/readable_stream/mod.rs b/src/readable_stream/mod.rs
index d33d1eb..0d61555 100644
--- a/src/readable_stream/mod.rs
+++ b/src/readable_stream/mod.rs
@@ -79,8 +79,8 @@ pub trait UnderlyingSource {
Ok(())
}
- async fn cancel(&mut self, controller: &JsValue) -> Result<(), JsValue> {
- ... | 1 | 2 | 2 |
a45f1589db6fdcefcffde6c7ad88473090f8c06a | Mattias Buelens | 2019-11-06T22:24:35 | Add ReadableStream.forget | diff --git a/src/readable_stream/mod.rs b/src/readable_stream/mod.rs
index 8b8d88d..d33d1eb 100644
--- a/src/readable_stream/mod.rs
+++ b/src/readable_stream/mod.rs
@@ -60,6 +60,11 @@ impl ReadableStream {
inner: Some(self.inner.get_reader()?)
})
}
+
+ pub fn forget(self) -> RawReadableStr... | 1 | 7 | 1 |
6cb2aff72d720f153a603ead9589c55bab410223 | Mattias Buelens | 2019-11-06T22:21:59 | Hide JsUnderlyingSource | diff --git a/src/readable_stream/mod.rs b/src/readable_stream/mod.rs
index 6229b3e..8b8d88d 100644
--- a/src/readable_stream/mod.rs
+++ b/src/readable_stream/mod.rs
@@ -80,7 +80,7 @@ pub trait UnderlyingSource {
}
}
-pub struct JsUnderlyingSource {
+struct JsUnderlyingSource {
inner: RawUnderlyingSource,
... | 1 | 1 | 1 |
94d82562dd04872a307a0bdedd38d649578c46b7 | Mattias Buelens | 2019-11-06T22:20:20 | Restructure crate | diff --git a/src/lib.rs b/src/lib.rs
index 9e6caaf..81d5a23 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,5 +1 @@
-pub use readable_stream::*;
-pub use sys::ReadableStreamDefaultController;
-
-mod sys;
pub mod readable_stream;
diff --git a/src/readable_stream.rs b/src/readable_stream/mod.rs
similarity index 99%
renam... | 4 | 5 | 8 |
00ebfaf11dbfd54d6585c717cc065d9b56cc62d6 | Mattias Buelens | 2019-11-06T21:12:55 | Silence warnings about unused variables | diff --git a/src/readable_stream.rs b/src/readable_stream.rs
index 6fe620e..ef726d1 100644
--- a/src/readable_stream.rs
+++ b/src/readable_stream.rs
@@ -20,7 +20,7 @@ use crate::sys::{
pub struct ReadableStream {
inner: RawReadableStream,
- source: JsUnderlyingSource,
+ _source: JsUnderlyingSource,
}
... | 1 | 5 | 2 |
7ac37a37ed496606c6924a2195313e64a9363cb4 | Mattias Buelens | 2019-11-01T15:57:26 | Use boxed source as input | diff --git a/src/readable_stream.rs b/src/readable_stream.rs
index 6f5d537..6fe620e 100644
--- a/src/readable_stream.rs
+++ b/src/readable_stream.rs
@@ -24,7 +24,7 @@ pub struct ReadableStream {
}
impl ReadableStream {
- pub fn new<S: UnderlyingSource + 'static>(source: S) -> ReadableStream {
+ pub fn new(sou... | 2 | 7 | 7 |
7213b6761a569103a8c34f43867c356553f69bba | Mattias Buelens | 2019-10-31T00:24:18 | Use RefCell instead of async Mutex | diff --git a/src/readable_stream.rs b/src/readable_stream.rs
index a4a46ad..6f5d537 100644
--- a/src/readable_stream.rs
+++ b/src/readable_stream.rs
@@ -1,7 +1,7 @@
+use std::cell::RefCell;
use std::rc::Rc;
use futures::{Stream, TryFutureExt, TryStreamExt};
-use futures::lock::Mutex;
use futures::stream::unfold;
... | 1 | 10 | 10 |
51b62d7f68b346fbc64747ecedda7ad65e6c498e | Mattias Buelens | 2019-10-30T23:35:58 | Refactor underlying source to async trait | diff --git a/Cargo.toml b/Cargo.toml
index 91685f4..b6a4187 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,6 +11,7 @@ js-sys = "0.3.28"
wasm-bindgen = "0.2.51"
wasm-bindgen-futures = "0.4.1"
futures = "0.3.0"
+async-trait = "0.1.17"
[dev-dependencies]
wasm-bindgen-test = "0.3.1"
diff --git a/src/readable_stream... | 4 | 106 | 70 |
3e78adb5f2303e2114c4795e6de3d6722963b802 | Mattias Buelens | 2019-11-06T20:42:00 | Move pin-utils to dev dependencies | diff --git a/Cargo.toml b/Cargo.toml
index 36e063a..91685f4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,7 +11,7 @@ js-sys = "0.3.28"
wasm-bindgen = "0.2.51"
wasm-bindgen-futures = "0.4.1"
futures = "0.3.0"
-pin-utils = "0.1.0-alpha.4"
[dev-dependencies]
wasm-bindgen-test = "0.3.1"
+pin-utils = "0.1.0-alpha.4... | 1 | 1 | 1 |
7569c97a52a1b626fb18fb49e636533879a1b228 | Mattias Buelens | 2019-11-06T20:30:01 | Update to futures v0.3.0 | diff --git a/Cargo.toml b/Cargo.toml
index e13d936..36e063a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,7 +10,7 @@ edition = "2018"
js-sys = "0.3.28"
wasm-bindgen = "0.2.51"
wasm-bindgen-futures = "0.4.1"
-futures-preview = "0.3.0-alpha.19"
+futures = "0.3.0"
pin-utils = "0.1.0-alpha.4"
[dev-dependencies] | 1 | 1 | 1 |
8672239fb6308cdd477cf7029491a902bbe8539a | Mattias Buelens | 2019-10-25T22:49:12 | Return a promise from underlying source methods | diff --git a/src/readable_stream.rs b/src/readable_stream.rs
index e3c2d38..9f4bfa9 100644
--- a/src/readable_stream.rs
+++ b/src/readable_stream.rs
@@ -1,6 +1,6 @@
use futures::{Stream, TryFutureExt, TryStreamExt};
use futures::stream::unfold;
-use js_sys::Object;
+use js_sys::{Object, Promise};
use wasm_bindgen::c... | 3 | 14 | 11 |
6d5f3d18df662cc95b93007de36c6104b94ccf01 | Mattias Buelens | 2019-10-25T21:40:32 | Add test for aborting a pending read | diff --git a/tests/tests.rs b/tests/tests.rs
index c6bab6b..1220a24 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -2,6 +2,7 @@
extern crate wasm_bindgen_test;
+use futures::future::{abortable, Aborted, join};
use futures::stream::StreamExt;
use pin_utils::pin_mut;
use wasm_bindgen::prelude::*;
@@ -63,4 +6... | 1 | 23 | 0 |
140a4b2b41d9c4bde156bd4a6803eab3c28fd4be | Mattias Buelens | 2019-10-25T21:37:36 | Inline stuff | diff --git a/src/readable_stream.rs b/src/readable_stream.rs
index 181c3d2..e3c2d38 100644
--- a/src/readable_stream.rs
+++ b/src/readable_stream.rs
@@ -25,6 +25,7 @@ impl ReadableStream {
}
}
+ #[inline]
pub fn as_raw(&self) -> &RawReadableStream {
&self.inner
}
@@ -91,6 +92,7 @@ ... | 1 | 3 | 0 |
ef1985df83517418623159ab2236cb600938798d | Mattias Buelens | 2019-10-25T21:37:27 | Release lock at most once | diff --git a/src/readable_stream.rs b/src/readable_stream.rs
index 4404246..181c3d2 100644
--- a/src/readable_stream.rs
+++ b/src/readable_stream.rs
@@ -47,7 +47,7 @@ impl ReadableStream {
pub fn get_reader(&mut self) -> Result<ReadableStreamDefaultReader, JsValue> {
Ok(ReadableStreamDefaultReader {
- ... | 2 | 34 | 7 |
a9c59f6243a5870f1f22e7e8719e844dedd8de63 | Mattias Buelens | 2019-10-25T20:34:05 | Release lock when reader is dropped | diff --git a/src/readable_stream.rs b/src/readable_stream.rs
index 73ace89..4404246 100644
--- a/src/readable_stream.rs
+++ b/src/readable_stream.rs
@@ -134,10 +134,12 @@ impl ReadableStreamDefaultReader {
Ok(Some(result.value()))
}
}
+}
- pub fn release_lock(&mut self) -> Result<(), JsV... | 1 | 5 | 3 |
8a8f099a011da22484e1d188ca3ac6c5bd4b1239 | Mattias Buelens | 2019-10-25T20:09:14 | Drop reader when a read errors | diff --git a/src/readable_stream.rs b/src/readable_stream.rs
index a10a9a0..73ace89 100644
--- a/src/readable_stream.rs
+++ b/src/readable_stream.rs
@@ -148,11 +148,12 @@ impl ReadableStream {
async fn into_stream_fut(mut self) -> Result<impl Stream<Item=Result<JsValue, JsValue>>, JsValue> {
let reader ... | 1 | 4 | 3 |
be9b060b244ee1397b98e4d58e0293717d8c8468 | Mattias Buelens | 2019-10-23T23:39:12 | Add ReadableStream.into_stream method | diff --git a/Cargo.toml b/Cargo.toml
index 4f30e98..e13d936 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,6 +10,8 @@ edition = "2018"
js-sys = "0.3.28"
wasm-bindgen = "0.2.51"
wasm-bindgen-futures = "0.4.1"
+futures-preview = "0.3.0-alpha.19"
+pin-utils = "0.1.0-alpha.4"
[dev-dependencies]
wasm-bindgen-test = ... | 3 | 45 | 1 |
733d53b5324ef0a6ae46dc068108d7b9b93aacbc | Mattias Buelens | 2019-10-23T23:37:03 | Add Reader.release_lock method | diff --git a/src/readable_stream.rs b/src/readable_stream.rs
index 014d69a..f20007d 100644
--- a/src/readable_stream.rs
+++ b/src/readable_stream.rs
@@ -132,4 +132,9 @@ impl ReadableStreamDefaultReader {
Ok(Some(result.value()))
}
}
+
+ pub fn release_lock(&mut self) -> Result<(), JsValue>... | 1 | 5 | 0 |
7c1dd872f6c91b4b992ff4c0b7d5fa7a1af30188 | Mattias Buelens | 2019-10-23T23:32:50 | Require exclusive borrow for reader methods | diff --git a/src/readable_stream.rs b/src/readable_stream.rs
index 9cb6673..014d69a 100644
--- a/src/readable_stream.rs
+++ b/src/readable_stream.rs
@@ -111,19 +111,19 @@ impl ReadableStreamDefaultReader {
Ok(())
}
- pub async fn cancel(&self) -> Result<(), JsValue> {
+ pub async fn cancel(&mut se... | 1 | 3 | 3 |
747ad441db1d7c69693fbd400a53f0baf80e61bc | Mattias Buelens | 2019-10-22T22:26:27 | Move user-friendly APIs to separate module | diff --git a/src/lib.rs b/src/lib.rs
index 86cd449..9e6caaf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1 +1,5 @@
-pub mod sys;
+pub use readable_stream::*;
+pub use sys::ReadableStreamDefaultController;
+
+mod sys;
+pub mod readable_stream;
diff --git a/src/readable_stream.rs b/src/readable_stream.rs
new file mode 10... | 4 | 162 | 74 |
6ced6fbe346286bb47907f77080956b3a8c2099e | Mattias Buelens | 2019-10-22T20:14:49 | Rename bindings to sys | diff --git a/src/lib.rs b/src/lib.rs
index 90c70dc..86cd449 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1 +1 @@
-pub mod bindings;
+pub mod sys;
diff --git a/src/bindings.rs b/src/sys.rs
similarity index 100%
rename from src/bindings.rs
rename to src/sys.rs
diff --git a/tests/tests.rs b/tests/tests.rs
index 04fb39d..2... | 3 | 2 | 2 |
ad38bedc3b913fe0a23d9b2bfa59055982a896bb | Mattias Buelens | 2019-10-18T21:56:41 | Expose promises as futures | diff --git a/src/bindings.rs b/src/bindings.rs
index 9a846ef..fa43fee 100644
--- a/src/bindings.rs
+++ b/src/bindings.rs
@@ -17,15 +17,29 @@ extern "C" {
pub fn locked(this: &ReadableStream) -> bool;
#[wasm_bindgen(method, js_name = cancel)]
- pub fn cancel(this: &ReadableStream) -> Promise;
+ fn _can... | 2 | 41 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.