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

add is_some and is_none to OptionFuture #2690

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MarinPostma
Copy link

This PR adds is_some and is_none to OptionFuture. This is useful when you only want to poll the OptionFuture if it contains a future (i.e treat None as never).

@MarinPostma MarinPostma requested a review from taiki-e as a code owner January 17, 2023 10:04
@taiki-e
Copy link
Member

taiki-e commented Jan 20, 2023

Hmm. This could be a bit misleading API, since in the current implementation OptionFuture does not set the inner field to None when the future is complete.

We may want to set the inner field to None on completion and make is_none return true "if the future is absent or completed".

@taiki-e taiki-e added the A-future Area: futures::future label Jul 19, 2023
@taiki-e taiki-e removed their request for review July 19, 2023 16:17
@taiki-e taiki-e added the S-needs-decision Status: A decision on whether or not to do this is needed. label Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-future Area: futures::future S-needs-decision Status: A decision on whether or not to do this is needed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants