{
  "id": 5772437,
  "title": "Visualizing Rust's Vtables: How dyn Trait Works In Memory",
  "url": "https://urgent.news/2026/09/05/visualizing-rusts-vtables-how-dyn-trait-works-in-memory",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-05T11:50:24.000Z",
  "source": {
    "name": "Lobsters",
    "slug": "lobsters",
    "url": "https://sofiabelen.github.io/projects/visualizing-rusts-vtables-how-dyn-trait-works-in-memory/"
  },
  "original_language": "en",
  "account": "Rust's approach to polymorphism through dyn Trait differs from C++'s virtual functions and CRTP (Curiously Recurring Template Pattern) due to Rust's emphasis on static dispatch. Static dispatch in Rust, also known as generics, generates separate copies of functions for each type they're called with, eliminating runtime cost while requiring types to be known at compile time. This approach offers compile-time type safety and eliminates runtime overhead compared to C++'s CRTP, which relies on compile-time polymorphism with a potential readability trade-off.\n\nOne notable difference between Rust and C++ is the handling of zero-sized types (ZSTs). In Rust, ZSTs are structs without any fields and don't require allocation of memory. The borrow-checker tracks identity through ownership, not addresses, ensuring a unique address for each value. However, the compiler doesn't make guarantees about ZST addresses, and in debug mode, it assigns a dummy stack slot for debugging purposes. Release mode behavior varies, emphasizing Rust's focus on compile-time guarantees and ownership tracking rather than memory addresses.",
  "summary": null,
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 2,
    "also_reported_by": [
      {
        "outlet": "Hacker News",
        "title": "Visualizing Rust's Vtables: How dyn Trait Works In Memory",
        "url": "https://urgent.news/2026/09/05/visualizing-rusts-vtables-how-dyn-trait-works-in-memory-5824175",
        "published": "2026-09-05T13:31:05.000Z"
      }
    ]
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}