198: Remove Unpin bound in `impl Stream for T` r=stjepang a=tirr-c
I guess this is not needed anymore since we have `poll_next` that receives `Pin` now. The original bound is moved to `Stream::next`.
Co-authored-by: Wonwoo Choi <chwo9843@gmail.com>
196: Remove more Unpin bounds for Stream::scan r=stjepang a=tirr-c
cc #192. I missed the bounds on `Stream::scan` itself.
Co-authored-by: Wonwoo Choi <chwo9843@gmail.com>
171: Add BufRead::consume r=stjepang a=yoshuawuyts
Ref #131. This implements `BufReader::consume`. Thanks!
Note on `fill_buf`: I couldn't get the `async fn fill_buf()` to work, but tracked progress for it here: https://gist.github.com/yoshuawuyts/09bbdc7823225ca96b5e35cd1da5d581. Got some lifetimes isssues. If anyone wants to give this a shot, please do!
Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
192: Add Stream::scan r=stjepang a=tirr-c
Ref #129. The mapper function `f` is synchronous and returns bare `Option<B>`.
Asynchronous `f` seems tricky to implement right. It requires the wrapper to be self-referential, as a reference to internal state may be captured by the returned future.
Co-authored-by: Wonwoo Choi <chwo9843@gmail.com>
177: implement DoubleEndedStream r=yoshuawuyts a=yoshuawuyts
Ref #129. This is the most basic version of the `DoubleEndedStream` trait. Because there is no counterpart in `futures-rs` we allow this to be implementable (not sure if we should though?).
This is not a high-priority trait to implement, with probably the most useful addition being the blanket impl over [`std::iter::Fuse`](https://doc.rust-lang.org/std/iter/struct.Fuse.html) (where we should have a `Fuse` counterpart for `Stream` also).
So I'm taking this one step at the time, and this PR introduces just the bare minimum to get things working. Thanks!
r? @stjepang @taiki-e
## Refs
- https://doc.rust-lang.org/std/iter/trait.DoubleEndedIterator.html
- #129
Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
184: housekeeping after 145 r=yoshuawuyts a=montekki
Now that #145 is merged combinators can follow.
1. All combinators taking `&mut self` should imply `Self: Pin`.
2. Trait bounds are to `Stream`
3. Cleans up docs and `Debug` derives.
Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
189: links the timeout docs to each other r=yoshuawuyts a=yoshuawuyts
Was talking in chat about futures timeouts, and apparently folks missed we had two different timeout functions. This links them to each other so if you find one, you also become aware of the other. Thanks!
Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
188: Refactor the networking driver r=stjepang a=stjepang
This is a big cleanup that simplifes the layer between mio and our networking driver. The `Watcher` API was pretty much entirely designed by @yoshuawuyts.
Fixes#185
Co-authored-by: Stjepan Glavina <stjepang@gmail.com>
145: Add Stream::poll_next r=stjepang a=stjepang
Adding `poll_next` to the `Stream` trait will simplify #125.
After a discussion with @yoshuawuyts and @withoutboats, we became confident that the `Stream` trait of the future will never solely rely on `async fn next()` and will always have to rely on `fn poll_next()`.
This PR now makes our `Stream` trait implementable by end users.
I also made a few adjustments around pinning to `all()` and `any()` combinators since they take a `&mut self`, which implies `Self: Unpin`. A rule of thumb is that if a method takes a `&mut self` and then pins `self`, we *have to* require `Self: Unpin`.
Co-authored-by: Stjepan Glavina <stjepang@gmail.com>