-
Notifications
You must be signed in to change notification settings - Fork 649
Allow !Unpin Sinks in Forward combinator #1441
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
Allow !Unpin Sinks in Forward combinator #1441
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.
LGTM.
We discussed changing Forward
to drop the sink on completion instead of returning it on Discord, I feel it better fits the design of the 0.3 combinators (passing a sink by-ref in an async fn if necessary), and helps with cases where you accidentally keep it alive longer than you mean to (like the fanout
test does, causing the timeout on the first commit).
@cramertj Any particular thoughts on this change to the API? |
It seems like maybe we should require passing |
Another alternative would be to just update the documentation to say this will close the provided |
@Nemo157 That sounds like a good idea. I can update the documentation, if you would like. Could you please elaborate on what you have in mind with an uncloseable adapter? Would this be another combinator we would add to the |
Another thing to note: if we do not need to return the sink directly from |
I've started the mpsc changes in #1443. The uncloseable adaptor would just wrap a sink and call let mut sink = foo();
await!(stream.forward(sink.by_ref().dont_close()))?;
await!(sink.send(some_final_item))?;
await!(sink.close())?; |
Sounds good! I've just pushed some commits updating the |
e3f19dc
to
8a2d6f7
Compare
Interesting, |
Ah, yes. I just noticed this as well when trying to navigate to |
LGTM-- would you mind flattening your commits to remove the previous changes to |
2a057a3
to
df75f22
Compare
df75f22
to
28ab681
Compare
@cramertj Okay, I've flattened away the redundant commits! I hope the commit history looks satisfactory now. |
Thanks! |
Changed
Forward
so it drops the sink without returning it. Users wishing to access the sink again can pass a&mut sink
toStreamExt::forward()
.Forward
andStreamExt::forward()
.Removed
Unpin
sinks onForward
.Fixes #1440. /CC @Nemo157.