Struct rdir_encoding::Delta [] [src]

pub struct Delta;

Delta encoding.

Delta encoding is used to store an array of numbers. Instead of storing the numbers themselves, the differences (deltas) between the numbers are stored. When the values of the deltas are smaller than the numbers themselves they can be more efficiently packed to require less space.

Note that arrays in which the values change by an identical amount for a range of consecutive values lend themselves to subsequent run-length encoding.

Examples

use rdir_encoding::Delta;

let encoded =      [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 5];
let expected = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 20];

let decoded = Delta::decode(&encoded).unwrap();
assert_eq!(expected, decoded);

Methods

impl Delta
[src]

[src]

Decode given values

[src]

Encode any array of 'T' where T can be any Integer.

Trait Implementations

impl Debug for Delta
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Delta

impl Sync for Delta