Crate lz_diet

Crate lz_diet 

Source
Expand description

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 AdjacentBound for a type using the specified value to represent an increment of “one”.

Structs§

Diet
An AVL balanced Discrete Interval Encoding Tree where each node represents a discrete (non-touching) interval.
DietNode
Interval
A wrapper for Range<T> which exposes some useful methods.
IntoIter
An owned Iterator for DietNode
Iter
A borrowing Iterator for DietNode

Traits§

AdjacentBound
For types which have adjacent values.

Type Aliases§

DietNodePtr