flat-tree 4.1.0

Rust module for encoding/decoding varints that doesn't do any IO. Inspired by the Node.js varint module
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
extern crate flat_tree;

#[test]
/// Postmortem: offset was incorrectly calculated when finding a parent for a
/// node with an odd offset.
fn parent_and_odd_offset() {
  let mut iterator = flat_tree::Iterator::new(10);
  assert_eq!(iterator.index(), 10);
  assert_eq!(iterator.offset(), 5);
  assert_eq!(iterator.parent(), 9);
  assert_eq!(iterator.offset(), 2);
  assert_eq!(iterator.parent(), 11);
  assert_eq!(iterator.offset(), 1);
}