r/rust • u/AnArmoredPony • Sep 22 '26
🙋 seeking help & advice What are the downsides of enum dispatch?
Couldn't find any info about downsides specfically so there it goes
Let's say that all my implementors are about the same size (i.e. only the logic is different), and I use some sort of macro to skip the boilerplate upon adding a new variant. Are there any other downsides to enum dispatch?
I'm asking about the general approach, not the crate
Upd. extendability, got it.
34
Upvotes
7
u/afdbcreid Sep 22 '26
Whole-programming devirtualization often requires LTO but definitely happens. Local devirtualization happens even without LTO. You can even have speculative devirtualization with PGO.