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

Is it possible to disallow/skip certain enum variations? #193

Closed
srfsh opened this issue Sep 23, 2024 · 1 comment
Closed

Is it possible to disallow/skip certain enum variations? #193

srfsh opened this issue Sep 23, 2024 · 1 comment

Comments

@srfsh
Copy link

srfsh commented Sep 23, 2024

My use case requires me to skip a certain enum variation to be selected. It is the gRPC's "unspecified" values if you're familiar. They are used as the default value if not specified by the other end. It basically works like a null value in JSON, meaning if the value is null or really isn't provided, it is considered null.

I think my use case is quite applicable to others, as it is often the first choice to use the first variation of an enum for a "zero value". So my question is whether this is possible or not and if I can workaround it.

@cksac
Copy link
Owner

cksac commented Sep 25, 2024

with version 2.10.0

#[derive(Eq, PartialEq, Debug, Dummy)]
enum MyEnum {
    One,
    #[dummy(skip)]
    Two,
}

@cksac cksac closed this as completed Sep 25, 2024
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

2 participants