Skip to content

Handle unknown enum variant magics as not-errors #234

Answered by csnover
micolous asked this question in Q&A
Discussion options

You must be logged in to vote

Enum parsing is done by attempting to parse each variant in order until one of them succeeds. Only if all variants fail is it considered a failure. So just don’t put any magic on the fallback Unknown variant and so long as there is no error parsing the variant’s members the parent enum will be considered parsed successfully. (The error handling directives are to avoid wasting time/memory storing errors that you don’t care about.)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@micolous
Comment options

Answer selected by micolous
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #233 on November 03, 2023 04:25.