Skip to main content

diskann_utils/
lib.rs

1/*
2 * Copyright (c) Microsoft Corporation.
3 * Licensed under the MIT license.
4 */
5
6//! Shared utilities for DiskANN crates.
7
8#[cfg(not(target_endian = "little"))]
9compile_error!("diskann-utils assumes little-endian targets");
10
11pub mod reborrow;
12pub use reborrow::{Reborrow, ReborrowMut};
13
14pub mod future;
15
16pub mod io;
17pub mod object_pool;
18pub mod sampling;
19
20// Views
21pub mod strided;
22pub mod views;
23
24mod lazystring;
25pub use lazystring::LazyString;
26
27mod internal;
28
29/// There are *no* external stability guarantees for anything in `testing`.
30///
31/// Use at your own risk.
32#[cfg(any(test, feature = "testing"))]
33#[doc(hidden)]
34pub mod testing;
35
36#[cfg(feature = "testing")]
37#[doc(hidden)]
38pub fn workspace_root() -> std::path::PathBuf {
39    std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"))
40        .parent()
41        .unwrap()
42        .to_path_buf()
43}
44
45#[cfg(feature = "testing")]
46#[doc(hidden)]
47pub fn test_data_directory() -> &'static str {
48    "test_data"
49}
50
51#[cfg(feature = "testing")]
52#[doc(hidden)]
53pub fn test_data_root() -> std::path::PathBuf {
54    workspace_root().join(test_data_directory())
55}