You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently ran into a use case where I was passing down an enum type to a function and I needed that value to be a specific variant of the enum type. First, is it an anti-pattern? Second, if not, Is that something that we'd want to add to this crate?
The text was updated successfully, but these errors were encountered:
Your proposed implementation doesn't assert anything statically, it all happens at runtime (unless you run it in a const context, but the example doesn't do that). To clarify, statically means at compile time.
If you want a function to only take a specific variant, I'd recommend just passing the field(s) of that variant.
@konsumlamm, my bad, I'm not sure what I was thinking while drawing up that implementation. I have updated the question to remove the proposed implementation.
I recently ran into a use case where I was passing down an enum type to a function and I needed that value to be a specific variant of the enum type. First, is it an anti-pattern? Second, if not, Is that something that we'd want to add to this crate?
The text was updated successfully, but these errors were encountered: