diskann-quantization 0.51.0

DiskANN is a fast approximate nearest neighbor search library for high dimensional data
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*
 * Copyright (c) Microsoft Corporation.
 * Licensed under the MIT license.
 */

use diskann_quantization::bits::{MutBitSlice, Unsigned};

// Here - we test that a `MutBitSlice` is properly tracked by Rust as containing
// a mutable borrow of its input slice.
fn main() {
    let mut x: Vec<u8> = vec![0; 3];
    let mut slice = MutBitSlice::<8, Unsigned>::new(x.as_mut_slice(), 3).unwrap();
    slice.set(0, 0).unwrap();
    x[1] = 1;
    slice.set(2, 2).unwrap();
}