Crate rle_vec[][src]

This crate provides RleVec, a vector like structure that stores runs of identical values coded by the value and the number of repeats.

If your data consists of long stretches of identical values is can be beneficial to only store the number of times each value occurs. This can result in significant space savings, but there is a cost. Accessing an arbitrary index requires a binary search over the stored runs resulting in a O(log n) complexity versus O(1) for a normal vector. Other complexities are in the table where n is equal to the number of runs, not the length of a comparable Vec.

pushindexset with breaking a runset without breaking a runinsert with breaking a runinsert without breaking a run
RleVecO(1)O(log n)O((log n) + 2n)O(log n)O((log n) + 2n)O((log n) + n)



Immutable RelVec iterator over references of values.


The RleVec struct handles like a normal vector and supports a subset from the Vec methods.


Represent a run inside the RleVec, can be obtained from the runs. A run is a serie of the same value.


Immutable RelVec iterator over runs.