cuvs-sys 26.4.0

Low-level rust bindings to libcuvs
/*
 * SPDX-FileCopyrightText: Copyright (c) 2024, NVIDIA CORPORATION.
 * SPDX-License-Identifier: Apache-2.0
 */

// ignore warnings from bindgen
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(unused_attributes)]

// include the generated cuvs_bindings.rs file directly in here
// (this file is automatically generated by bindgen in build.rs)
include!(concat!(env!("OUT_DIR"), "/cuvs_bindings.rs"));

#[cfg(test)]
mod tests {
    use super::*;
    // some super basic tests here to make sure we can call into the cuvs library
    // the actual logic will be tested out through the higher level bindings

    #[test]
    fn test_create_cagra_index() {
        unsafe {
            let mut index = core::mem::MaybeUninit::<cuvsCagraIndex_t>::uninit();
            assert_eq!(
                cuvsCagraIndexCreate(index.as_mut_ptr()),
                cuvsError_t::CUVS_SUCCESS
            );
            let index = index.assume_init();
            assert_eq!(cuvsCagraIndexDestroy(index), cuvsError_t::CUVS_SUCCESS);
        }
    }

    #[test]
    fn test_create_resources() {
        unsafe {
            let mut res: cuvsResources_t = 0;
            assert_eq!(cuvsResourcesCreate(&mut res), cuvsError_t::CUVS_SUCCESS);
            assert_eq!(cuvsResourcesDestroy(res), cuvsError_t::CUVS_SUCCESS);
        }
    }
}