pub fn offset_with_depth(i: usize, depth: usize) -> usize
Expand description

Returns the offset of a node with a depth.

Examples

assert_eq!(flat_tree::offset_with_depth(0, 0), 0);
assert_eq!(flat_tree::offset_with_depth(1, 1), 0);
assert_eq!(flat_tree::offset_with_depth(2, 0), 1);
assert_eq!(flat_tree::offset_with_depth(3, 2), 0);
assert_eq!(flat_tree::offset_with_depth(4, 0), 2);