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

Returns the parent of a node with a depth.

Examples

assert_eq!(flat_tree::parent_with_depth(0, 0), 1);
assert_eq!(flat_tree::parent_with_depth(1, 1), 3);
assert_eq!(flat_tree::parent_with_depth(2, 0), 1);
assert_eq!(flat_tree::parent_with_depth(3, 2), 7);
assert_eq!(flat_tree::parent_with_depth(4, 0), 5);