[−][src]Crate lz_diet
This crate provides a Discrete Interval Encoding Tree (DIET) implementation.
At a small performance cost on mutation of the tree, large memory savings are made and performance gains may be made on lookup of elements.
An example of using the Diet<T>
:
use lz_diet::{Diet, Interval}; let mut diet = Diet::new(); diet.insert(5); diet.insert(7); diet.insert(6); let intervals: Vec<_> = diet.into_iter().collect(); assert_eq!(&intervals[..], &[Interval::from(5..8)]);
Interval endpoints are evaluated to determine whether the interval is
discrete, this check implemented with the AdjacentBound
trait and may be
quickly implemented for types with a scalar interval using the
adjacent_bound_impl
macro provided.
Macros
adjacent_bound_impl | Implements |
Structs
Diet | An AVL balanced Discrete Interval Encoding Tree where each node represents a discrete (non-touching) interval. |
DietNode | |
Interval | A wrapper for |
IntoIter | An owned |
Iter | A borrowing |
Traits
AdjacentBound | For types which have adjacent values. |
Type Definitions
DietNodePtr |