Complete implementation of a binary tree with generic type parameters

We've finally progressed far enough in our journey through Rust that we can produce something truly useful. Our binary tree could still be improved in any number of ways, but it does what it was designed to do: it allows us to easily store and retrieve any number of key/value pairs.

We made no effort to ensure that the binary tree remains balanced, meaning that the left and right branches of each node are approximately the same height, because that wouldn't have added anything to our discussion of generic types. If we had, this data structure would also be guaranteed to be efficient. Balanced binary trees are close to being as good as you can get when it comes to arbitrary ...

Get Rust Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.