It is not possible to create cyclic structures with borrowed pointers.
There is not any good way of achieving cyclic data structures at present; the only real solutions are:
- Use reference counting with
Rc<T>with a cyclic structure withRc::new()andRc:downgrade(). Read thercmodule documentation and be careful to not create cyclic structures that use strong references, as these will cause memory leaks. - Use raw/unsafe pointers (
*T).