doublets 0.8.0

Doublets (links) data structure implementation.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! A self reference must remain internal while its link is being updated.

use doublets::{mem::Global, split, Doublets, Links};

#[test]
fn updating_a_self_reference_keeps_it_in_the_internal_target_index() {
    let mut store = split::Store::<usize, _, _>::new(Global::new(), Global::new()).unwrap();
    let a = store.create_point().unwrap();
    let b = store.create_point().unwrap();
    store.update(a, b, a).unwrap();
    let any = store.constants().any;
    assert_eq!(store.count_by([any, any, a]), 1);
    // Misclassification used to make this detach an absent internal tree node.
    store.update(a, 0, 0).unwrap();
    assert_eq!(store.count_by([any, any, a]), 0);
}