• Sources: primary, discussion
  • Summary: The post inspects the in-memory layout behind dyn Trait in Rust. A dyn Trait reference is a wide pointer holding the data pointer and a vtable pointer, and the compiler emits one vtable for each type and trait pair.
  • Why it matters: Rust picks dispatch at the call site rather than the class level, so a type carries no vtable pointer until a reference asks for dynamic dispatch, which is the opposite of the C++ arrangement.

send feedback on this story