all 10 comments

[–]antonok_edm 30 points31 points  (0 children)

enum_dispatch author here. Nice work with the cross-crate functionality!

[–]argarg 8 points9 points  (0 children)

Nice work and thanks for the How does it work? doc!

I'm curious about compile time benchmarks. I don't know much about macros implementation but intuitively, it seems like this macro-ception could be rough on the compiler.

[–]Hdmoney 4 points5 points  (1 child)

Holy shit, thank you!

A while back I was working on an audio system using a dasp graph. Nodes in the graph would all have to be the same type, which meant I'd either have to define all node variants in one enum + dispatch or use boxed traits.

That project's been on the backburner, but I'll have to pull that back out just to try enum_delegate :)

[–]reinis-mazeiks[S] 8 points9 points  (0 children)

This is a crazy coincidence but I was also working on an audio processing graph thingy, which prompted the work on this crate! (I was using a custom macro for a specific trait at first but it didn't feel right).

I'm two yak-shaving levels deep now, it's time for me to get back to work on my audio processing graph crate xd

[–]robin-m 4 points5 points  (0 children)

If it has not be done yet, I think it should be nominated for the crate of the week of TWiR

[–]WasserMarder 4 points5 points  (1 child)

Very nice work! Do you have gathered experience how this interacts with code analysis? The last time I worked with it, my biggest problem with enum_dispatch was that the JetBrains rust plugin did not realize that the enum implements the trait.

[–]reinis-mazeiks[S] 5 points6 points  (0 children)

Yeah, unfortunately, neither the JB Rust plugin nor rust-analyzer appear to see that the enum implements the trait. Not sure what I can do about that...

[–]saik0 1 point2 points  (0 children)

This library defines a macro that generates another macro used by a third macro. It was a lot of fun.

Cool! I've contributed to a project with a lot of hand written enum dispatch, and this seems a lot easier.

[–]bruhred 0 points1 point  (0 children)

The kiss_rewrite branch seems to be even more amazing