Rust data structures with circular references

· Eli Bendersky · Nov. 13, 2021, 4:42 a.m.
Summary
To implement its safety guarantees, the Rust compiler keeps careful track of ownership and references throughout a program. This makes writing certain kinds of data structures challenging; in particular, data structures that have circular references. Let's start with a simple binary tree: struct Tree { root: Option<Node>, } struct Node { data …...
AUTHOR
BLOG POST FEATURED ON

Add this plugin to your blog