Open nain-F49FF806 opened 4 months ago
I'm glad that you reaching my obscure but favorite crate.
This crate generates AsVariant
impl for each variant like your TryFrom
one. A difference is that it emits 3 trait impls for each variant, AsVariant
for downcast_ref
, AsVariantMut
for downcast_mut
, and IntoVariant
for downcast
.
Readme's Items { vec: Vec<Item> }
is intended to show it does not distinguish a newtype variant and single field struct variant, but I need to update the README to explain it. now I updated it e492b55ca96cfca1b2a1e70ae866b29ced106cba
Hi, I saw your post on rust discourse, and ended up here. I have been looking at enum_dispatch and similar projects.
I am trying to understand if this does something different, than another approach I was thinking of using in my project.
I was considering using macro to automatically implement TryFrom<_> trait
So you can do
Does downcast solve a similar problem, or is it doing something else?
Also, this would be good for the readme: how does downcast handle the Items variant? That seems like an interesting case. :)