Zig rewrite of trees from OpenBSD.
Data structures ported
See src/main.zig for usage.
To use this library in your project, copy the file into your project and rename it as tree.zig
or something.
There is potential footgun when freeing nodes of a tree. See test "how to free nodes correctly"
in src/main.zig for correct usage.
Enhancements over the original:
tree.prev(node)
Also, the original C impl has some weird design choices, which I will not touch.
Also, invalid data given to the public API will not crash the program.