This is an automated archive made by the Lemmit Bot.
The original was posted on /r/rust by /u/hbacelar8 on 2025-06-10 12:26:56+00:00.
My question comes from my recent experience working implementing an embedded HAL based on the Embassy framework. The way the Rust’s type system is used by using traits as some sort of “tagging” for statically dispatching concrete types for guaranteeing interrupt handler binding is awesome.
I was wondering about some ways of implementing something alike in C++, but I know that virtual class inheritance is always virtual, which results in virtual tables.
So what’s the concrete comparison between trait and interfaces. Are traits better when compared to interfaces regarding binary size and performance? Am I paying a lot when using lots of composed traits in my architecture compared to interfaces?
Tks.