Skip to content

Comments

add is_some and is_none to OptionFuture#2690

Closed
MarinPostma wants to merge 1 commit intorust-lang:masterfrom
MarinPostma:option-future-is-some
Closed

add is_some and is_none to OptionFuture#2690
MarinPostma wants to merge 1 commit intorust-lang:masterfrom
MarinPostma:option-future-is-some

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
@MarinPostma MarinPostma closed this Jun 6, 2025
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