1#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)]
8
9pub const BUILD_INFO: &str = include_str!(concat!(env!("OUT_DIR"), "/build-info.txt"));
11
12#[cfg(feature = "dlmdb")]
13mod bindings {
14 #![allow(clippy::all, clippy::undocumented_unsafe_blocks)]
15 include!(concat!(env!("OUT_DIR"), "/bindings-dlmdb.rs"));
16}
17
18#[cfg(feature = "dlmdb")]
19pub use bindings::*;
20
21#[cfg(any(feature = "usearch", feature = "llama"))]
22pub mod runtime;
23
24#[cfg(feature = "usearch")]
25pub mod usearch {
26 use std::sync::OnceLock;
27 mod bindings {
28 #![allow(clippy::all, clippy::undocumented_unsafe_blocks)]
29 include!(concat!(env!("OUT_DIR"), "/bindings-usearch.rs"));
30 }
31 pub use bindings::*;
32 static API: OnceLock<Result<UsearchApi, String>> = OnceLock::new();
33
34 pub fn api() -> Result<&'static UsearchApi, &'static str> {
36 API.get_or_init(|| {
37 let library = super::runtime::load(env!("DTLVNATIVE_USEARCH_LIBRARY"))?;
38 unsafe { UsearchApi::from_library(library).map_err(|error| error.to_string()) }
41 })
42 .as_ref()
43 .map_err(String::as_str)
44 }
45}
46
47#[cfg(feature = "llama")]
48pub mod llama {
49 use std::sync::OnceLock;
50 mod bindings {
51 #![allow(clippy::all, clippy::undocumented_unsafe_blocks)]
52 include!(concat!(env!("OUT_DIR"), "/bindings-llama.rs"));
53 }
54 pub use bindings::*;
55 static API: OnceLock<Result<LlamaApi, String>> = OnceLock::new();
56
57 pub fn api() -> Result<&'static LlamaApi, &'static str> {
59 API.get_or_init(|| {
60 let library = super::runtime::load(env!("DTLVNATIVE_LLAMA_LIBRARY"))?;
61 unsafe { LlamaApi::from_library(library).map_err(|error| error.to_string()) }
64 })
65 .as_ref()
66 .map_err(String::as_str)
67 }
68}