lib.rs (899B)
1 #[allow(non_upper_case_globals)] 2 #[allow(non_camel_case_types)] 3 #[allow(non_snake_case)] 4 #[allow(unused)] 5 mod bindings; 6 7 use std::ffi::CString; 8 9 #[cfg(test)] 10 mod tests { 11 use super::*; 12 use bindings as ndb; 13 14 #[test] 15 fn ndb_init_works() { 16 unsafe { 17 // Initialize ndb 18 let mut ndb_ptr: *mut bindings::ndb = std::ptr::null_mut(); 19 let mut config = ndb::ndb_config { 20 filter_context: std::ptr::null_mut(), 21 ingest_filter: None, 22 flags: 0, 23 ingester_threads: 0, 24 mapsize: 0, 25 }; 26 27 let path = CString::new(".").expect("Failed to create CString"); 28 ndb::ndb_default_config(&mut config); 29 ndb::ndb_init(&mut ndb_ptr, path.as_ptr(), &mut config); 30 31 // Clean up 32 bindings::ndb_destroy(ndb_ptr); 33 } 34 } 35 }