I was inspired by Aria Desires' Learn Rust With Entirely Too Many Linked Lists to implement a binary search tree in Rust. Due to Rust's concept of ownership, it is tricky to implement a linked list. I assumed that it would be similarly challenging to write an "OK" tree.
cargo runThe Rust compiler now ships with Polonius an alternative library that can replace the borrow checker. I found it easier to implement some of the code using Polonius since the algorithm is "smarter" and allows for safe mutation of members of a struct within the same loop.
To use Polonius, install nightly Rust.
It is possible to render the tree using Graphviz. To achieve this, I've ported the C code from this terrific blog post.