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

Consider ways to simplify the variants for Promise's outputs #17

Open
1 task done
mxgrey opened this issue Aug 5, 2024 · 0 comments
Open
1 task done

Consider ways to simplify the variants for Promise's outputs #17

mxgrey opened this issue Aug 5, 2024 · 0 comments

Comments

@mxgrey
Copy link
Contributor

mxgrey commented Aug 5, 2024

Before proceeding, is there an existing issue or discussion for this?

Description

Promise uses PromiseState as its output for both sync and async usage.

Because of the many ways a request could become unable to deliver, there are several more variants than a user might expect. We should consider ways to simplify this so users aren't left scratching their heads over how to handle variants that they can't receive anyway.

  • We return PromiseState as the output of .await, but it contains a Pending variant which can't be the case after .await is finished.
  • We use Promise as the output of Channel::command, but that method will never result in a Cancellation and shouldn't realistically result in a Disposed either.
  • Taken is a variant we need to have because we store the result in the Promise, and a user can take it without dropping the promise. The existence of this variant might confuse users because they don't know what to do if they get it.
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

No branches or pull requests

1 participant