Skip to content
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

Adds unbonded select #1881

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Adds unbonded select #1881

wants to merge 16 commits into from

Conversation

CJP10
Copy link

@CJP10 CJP10 commented Sep 22, 2019

In a project I am working on I need the stream returned from select to close if either of the input streams are closed.

I figured this would be useful to someone else, so here I am.

I'm not sure about the name unbonded but I'm totally open to suggestions.

@taiki-e taiki-e added A-stream Area: futures::stream and removed futures-util labels Dec 17, 2020
@414owen
Copy link
Contributor

414owen commented Mar 19, 2022

@CJP10 This would be very useful for me! I'd love to see this merged. Surprised nobody else has needed this.

Looks like this needs to be updated to work with SelectWithStrategy. Not sure what the ideal semantics should be exactly, but at a brief glance, it looks like maybe PollNext could be generalized to have a Nothing option, to prevent future polling?

@taiki-e, if this code is updated and polished, would you be open to accepting the feature, and merging?

I'm not sure about the name unbonded but I'm totally open to suggestions.

How about select_short_circuit, or select_until_either_terminates?


As for my use case, I have a stream of data that's being written to a tcp socket, with long waits between elements, and I have a stream representing a heartbeat to keep the connection alive. I don't want to keep sending heartbeats once the data stream terminates.

@CJP10
Copy link
Author

CJP10 commented Mar 24, 2022

Similar to my use case. I'm open to refreshing the PR to be mergeable. It's be open for a while so might have to start from scratch.

@414owen
Copy link
Contributor

414owen commented Mar 25, 2022

@CJP10 I've drafted something here: 414owen#1
It builds on #2583, so any reviews on that would be appreciated too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-stream Area: futures::stream
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants