In general, self-referential structs are an anti-pattern in rust because moving the struct in memory would cause the references to become invalid.
Some additional reading on the topic:
- Incomplete mini-guide to self-reference (non-movable objects)
- How to write software without self-referential structs?
- How do I create self-referential structures with Pin
- https://www.reddit.com/r/rust/comments/7mc3n5/selfreferential_fields_in_structs/
- Improving self-referential structs - language design - Rust Internals
The short answer is that you can't create self-referential structs without significant restrictions and challenges. However, it turns out it's rarely truly necessary, so again, I'd ask why you need a pattern like this. What problem are you trying to solve?