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_x() methods for all EitherN enum variants #3650

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

avsaase
Copy link
Contributor

@avsaase avsaase commented Dec 14, 2024

This add is_x() methods on all EitherN enums to more concisely check which future from a SelectN completed first, without accessing the value.

I often use signals for canceling futures "from within" and it's not always needed to access the value of the future, only to know if the signal wait future completed first. This can of course also be achieved using matches!, if-let or let-else, but the methods added in this PR make this a bit more concise.

Copy link
Member

@lulf lulf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@lulf lulf added this pull request to the merge queue Dec 20, 2024
Merged via the queue into embassy-rs:main with commit c775604 Dec 20, 2024
10 checks passed
@avsaase avsaase deleted the either-is branch December 20, 2024 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants