-
Notifications
You must be signed in to change notification settings - Fork 6
Option to keep/generate "closed form" enum #25
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
Comments
I took a stab at implementing this in this branch: https://github.com/EmbarkStudios/open-enum/tree/with_closed but in actually trying to use it in our FFI layer it proved less ergonomic than I thought, so I'm not going to go ahead with cleaning it up and PRing unless some more design work happens. |
I'm thinking that maybe it should go the other way, where users can write I'm on the fence regarding a new trait. |
Some open questions and challenges: Does
|
A macro workaround for
|
In implementing #24 and using it in our code based, the
TryFromKnownRepr
is useful but only moderately, since you still can't get an exhaustive match on just the known variants afterwards. It would be nice to somehow expose the original closed form of the enum as well, either as justOriginalIdentClosed
or perhaps some traitthen you can
OriginalIdent::Closed
?And provide infallible
From<Closed> for Open
and fallibleTryFrom<Closed> for Open
, as replacement forTryFromKnownRepr
.The text was updated successfully, but these errors were encountered: