-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement DoubleEndedStream #177
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, provided we also add async fn next_back
.
A natural follow-up to this PR would be an equivalent of https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.rev
By the way, I wonder -- do you perhaps have an example use case for double-ended streams?
Not anything concretely; but it generally seems like a nice thing to have. One could imagine having a stream of tables queried from a database. In which case sometimes we want to go forward to the next page, but sometimes also backwards to the previous one (perhaps get previous ones from a local cache or something). This would allow us to express that behavior in the stream. |
Signed-off-by: Yoshua Wuyts <[email protected]>
Signed-off-by: Yoshua Wuyts <[email protected]>
7fab6f8
to
fda74ac
Compare
Signed-off-by: Yoshua Wuyts <[email protected]>
Implemented the feedback and marked this API as unstable so we get some wiggle room to change things even after 1.0. |
bors r+ |
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 <[email protected]>
Build succeeded
|
Ref #129. This is the most basic version of the
DoubleEndedStream
trait. Because there is no counterpart infutures-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
(where we should have aFuse
counterpart forStream
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