Self-referential structs: Which version is for you?

· Users Rust Lang · May 29, 2026, 7:17 a.m.
Summary
This blog post discusses challenges and workarounds for writing self-referential structs in Rust, exploring three different strategies: using raw pointers (unsafe), index offsets (safe), and macro crates (with dependencies). It critiques each method's impact on safety and expressiveness, ultimately questioning the best approach for developers.
AUTHOR