commit 05bbb8eba3b6c4da6272c2c9331ec90757e22ed6
Author: William Casarin <jb55@jb55.com>
Date: Thu, 14 Dec 2023 19:10:05 -0800
nostrdb in rust. woot.
Diffstat:
15 files changed, 4450 insertions(+), 0 deletions(-)
diff --git a/.envrc b/.envrc
@@ -0,0 +1 @@
+use nix
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1,3 @@
+.direnv/
+Cargo.lock
+target/
diff --git a/.gitmodules b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "nostrdb"]
+ path = nostrdb
+ url = https://github.com/damus-io/nostrdb
diff --git a/.rustfmt.toml b/.rustfmt.toml
@@ -0,0 +1 @@
+edition = "2018"
diff --git a/Cargo.toml b/Cargo.toml
@@ -0,0 +1,13 @@
+[package]
+name = "nostrdb"
+authors = ["William Casarin <jb55@jb55.com>"]
+description = "An unfairly fast embedded nostr database backed by lmdb"
+readme = "README.md"
+version = "0.1.0"
+edition = "2021"
+build = "build.rs"
+include = ["../deps", "src", "Cargo.toml", "build.rs", "../*.c", "../*.h"]
+
+[build-dependencies]
+cc = "1.0"
+#bindgen = "0.69.1" // re-enable when we update bindings
diff --git a/README.md b/README.md
@@ -0,0 +1,6 @@
+
+# nostrdb-rs
+
+[nostrdb][nostrdb] in Rust!
+
+[nostrdb]: https://github.com/damus-io/nostrdb
diff --git a/build.rs b/build.rs
@@ -0,0 +1,121 @@
+// build.rs
+use cc::Build;
+use std::env;
+use std::path::PathBuf;
+
+fn secp256k1_build() {
+ // Actual build
+ let mut base_config = cc::Build::new();
+ base_config
+ .include("nostrdb/deps/secp256k1/")
+ .include("nostrdb/deps/secp256k1/include")
+ .include("nostrdb/deps/secp256k1/src")
+ .flag_if_supported("-Wno-unused-function") // some ecmult stuff is defined but not used upstream
+ .flag_if_supported("-Wno-unused-parameter") // patching out printf causes this warning
+ //.define("SECP256K1_API", Some(""))
+ .define("ENABLE_MODULE_ECDH", Some("1"))
+ .define("ENABLE_MODULE_SCHNORRSIG", Some("1"))
+ .define("ENABLE_MODULE_EXTRAKEYS", Some("1"))
+ //.define("ENABLE_MODULE_ELLSWIFT", Some("0"))
+ // upstream sometimes introduces calls to printf, which we cannot compile
+ // with WASM due to its lack of libc. printf is never necessary and we can
+ // just #define it away.
+ .define("printf(...)", Some(""));
+
+ //if cfg!(feature = "lowmemory") {
+ // base_config.define("ECMULT_WINDOW_SIZE", Some("4")); // A low-enough value to consume negligible memory
+ // base_config.define("ECMULT_GEN_PREC_BITS", Some("2"));
+ //} else {
+ // base_config.define("ECMULT_GEN_PREC_BITS", Some("4"));
+ // base_config.define("ECMULT_WINDOW_SIZE", Some("15")); // This is the default in the configure file (`auto`)
+ //}
+
+ //base_config.define("USE_EXTERNAL_DEFAULT_CALLBACKS", Some("1"));
+ //#[cfg(feature = "recovery")]
+ //base_config.define("ENABLE_MODULE_RECOVERY", Some("1"));
+
+ // WASM headers and size/align defines.
+ if env::var("CARGO_CFG_TARGET_ARCH").unwrap() == "wasm32" {
+ base_config.include("wasm/wasm-sysroot").file("wasm/wasm.c");
+ }
+
+ // secp256k1
+ base_config
+ .file("nostrdb/deps/secp256k1/contrib/lax_der_parsing.c")
+ .file("nostrdb/deps/secp256k1/src/precomputed_ecmult_gen.c")
+ .file("nostrdb/deps/secp256k1/src/precomputed_ecmult.c")
+ .file("nostrdb/deps/secp256k1/src/secp256k1.c");
+
+ if base_config.try_compile("libsecp256k1.a").is_err() {
+ // Some embedded platforms may not have, eg, string.h available, so if the build fails
+ // simply try again with the wasm sysroot (but without the wasm type sizes) in the hopes
+ // that it works.
+ base_config.include("wasm/wasm-sysroot");
+ base_config.compile("libsecp256k1.a");
+ }
+}
+
+fn main() {
+ // Compile the C file
+ let mut build = Build::new();
+
+ build
+ .files([
+ "nostrdb/nostrdb.c",
+ "nostrdb/sha256.c",
+ "nostrdb/bech32.c",
+ "nostrdb/deps/flatcc/src/runtime/json_parser.c",
+ "nostrdb/deps/flatcc/src/runtime/verifier.c",
+ "nostrdb/deps/flatcc/src/runtime/builder.c",
+ "nostrdb/deps/flatcc/src/runtime/emitter.c",
+ "nostrdb/deps/flatcc/src/runtime/refmap.c",
+ "nostrdb/deps/lmdb/mdb.c",
+ "nostrdb/deps/lmdb/midl.c",
+ ])
+ .include("nostrdb/deps/lmdb")
+ .include("nostrdb/deps/flatcc/include")
+ .include("nostrdb/deps/secp256k1/include")
+ // Add other include paths
+ //.flag("-Wall")
+ .flag("-Wno-misleading-indentation")
+ .flag("-Wno-unused-function")
+ //.flag("-Werror")
+ //.flag("-g")
+ .compile("libnostrdb.a");
+
+ secp256k1_build();
+
+ // Re-run the build script if any of the C files or headers change
+ for file in &[
+ "nostrdb/nostrdb.c",
+ "nostrdb/sha256.c",
+ "nostrdb/bech32.c",
+ "nostrdb/nostrdb.h",
+ "nostrdb/sha256.h",
+ ] {
+ println!("cargo:rerun-if-changed={}", file);
+ }
+
+ println!("cargo:rustc-link-lib=secp256k1");
+
+ // Print out the path to the compiled library
+ let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
+ println!("cargo:rustc-link-search=native={}", out_path.display());
+ println!("cargo:rustc-link-lib=static=nostrdb");
+
+ //
+ // We only need bindgen when we update the bindings.
+ // I don't want to complicate the build with it.
+ //
+
+ /*
+ let bindings = bindgen::Builder::default()
+ .header("nostrdb/nostrdb.h")
+ .generate()
+ .expect("Unable to generate bindings");
+
+ bindings
+ .write_to_file("src/bindings.rs")
+ .expect("Couldn't write bindings!");
+ */
+}
diff --git a/nostrdb b/nostrdb
@@ -0,0 +1 @@
+Subproject commit c1d1d59076de51b00b069f5674a8183daeebcecc
diff --git a/shell.nix b/shell.nix
@@ -0,0 +1,7 @@
+{ pkgs ? import <nixpkgs> {} }:
+with pkgs;
+mkShell {
+ nativeBuildInputs = [ rustPlatform.bindgenHook cargo rustc rustfmt libiconv pkg-config ];
+
+ LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib";
+}
diff --git a/src/bindings.rs b/src/bindings.rs
@@ -0,0 +1,4174 @@
+/* automatically generated by rust-bindgen 0.69.1 */
+
+#[repr(C)]
+#[derive(Default)]
+pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>, [T; 0]);
+impl<T> __IncompleteArrayField<T> {
+ #[inline]
+ pub const fn new() -> Self {
+ __IncompleteArrayField(::std::marker::PhantomData, [])
+ }
+ #[inline]
+ pub fn as_ptr(&self) -> *const T {
+ self as *const _ as *const T
+ }
+ #[inline]
+ pub fn as_mut_ptr(&mut self) -> *mut T {
+ self as *mut _ as *mut T
+ }
+ #[inline]
+ pub unsafe fn as_slice(&self, len: usize) -> &[T] {
+ ::std::slice::from_raw_parts(self.as_ptr(), len)
+ }
+ #[inline]
+ pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
+ ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
+ }
+}
+impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> {
+ fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ fmt.write_str("__IncompleteArrayField")
+ }
+}
+pub const _INTTYPES_H: u32 = 1;
+pub const _FEATURES_H: u32 = 1;
+pub const _DEFAULT_SOURCE: u32 = 1;
+pub const __GLIBC_USE_ISOC2X: u32 = 0;
+pub const __USE_ISOC11: u32 = 1;
+pub const __USE_ISOC99: u32 = 1;
+pub const __USE_ISOC95: u32 = 1;
+pub const __USE_POSIX_IMPLICITLY: u32 = 1;
+pub const _POSIX_SOURCE: u32 = 1;
+pub const _POSIX_C_SOURCE: u32 = 200809;
+pub const __USE_POSIX: u32 = 1;
+pub const __USE_POSIX2: u32 = 1;
+pub const __USE_POSIX199309: u32 = 1;
+pub const __USE_POSIX199506: u32 = 1;
+pub const __USE_XOPEN2K: u32 = 1;
+pub const __USE_XOPEN2K8: u32 = 1;
+pub const _ATFILE_SOURCE: u32 = 1;
+pub const __WORDSIZE: u32 = 64;
+pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
+pub const __SYSCALL_WORDSIZE: u32 = 64;
+pub const __TIMESIZE: u32 = 64;
+pub const __USE_MISC: u32 = 1;
+pub const __USE_ATFILE: u32 = 1;
+pub const __USE_FORTIFY_LEVEL: u32 = 0;
+pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
+pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
+pub const __GLIBC_USE_C2X_STRTOL: u32 = 0;
+pub const _STDC_PREDEF_H: u32 = 1;
+pub const __STDC_IEC_559__: u32 = 1;
+pub const __STDC_IEC_60559_BFP__: u32 = 201404;
+pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
+pub const __STDC_IEC_60559_COMPLEX__: u32 = 201404;
+pub const __STDC_ISO_10646__: u32 = 201706;
+pub const __GNU_LIBRARY__: u32 = 6;
+pub const __GLIBC__: u32 = 2;
+pub const __GLIBC_MINOR__: u32 = 38;
+pub const _SYS_CDEFS_H: u32 = 1;
+pub const __glibc_c99_flexarr_available: u32 = 1;
+pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0;
+pub const __HAVE_GENERIC_SELECTION: u32 = 1;
+pub const _STDINT_H: u32 = 1;
+pub const __GLIBC_USE_LIB_EXT2: u32 = 0;
+pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0;
+pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0;
+pub const __GLIBC_USE_IEC_60559_EXT: u32 = 0;
+pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0;
+pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0;
+pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0;
+pub const _BITS_TYPES_H: u32 = 1;
+pub const _BITS_TYPESIZES_H: u32 = 1;
+pub const __OFF_T_MATCHES_OFF64_T: u32 = 1;
+pub const __INO_T_MATCHES_INO64_T: u32 = 1;
+pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1;
+pub const __STATFS_MATCHES_STATFS64: u32 = 1;
+pub const __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64: u32 = 1;
+pub const __FD_SETSIZE: u32 = 1024;
+pub const _BITS_TIME64_H: u32 = 1;
+pub const _BITS_WCHAR_H: u32 = 1;
+pub const _BITS_STDINT_INTN_H: u32 = 1;
+pub const _BITS_STDINT_UINTN_H: u32 = 1;
+pub const INT8_MIN: i32 = -128;
+pub const INT16_MIN: i32 = -32768;
+pub const INT32_MIN: i32 = -2147483648;
+pub const INT8_MAX: u32 = 127;
+pub const INT16_MAX: u32 = 32767;
+pub const INT32_MAX: u32 = 2147483647;
+pub const UINT8_MAX: u32 = 255;
+pub const UINT16_MAX: u32 = 65535;
+pub const UINT32_MAX: u32 = 4294967295;
+pub const INT_LEAST8_MIN: i32 = -128;
+pub const INT_LEAST16_MIN: i32 = -32768;
+pub const INT_LEAST32_MIN: i32 = -2147483648;
+pub const INT_LEAST8_MAX: u32 = 127;
+pub const INT_LEAST16_MAX: u32 = 32767;
+pub const INT_LEAST32_MAX: u32 = 2147483647;
+pub const UINT_LEAST8_MAX: u32 = 255;
+pub const UINT_LEAST16_MAX: u32 = 65535;
+pub const UINT_LEAST32_MAX: u32 = 4294967295;
+pub const INT_FAST8_MIN: i32 = -128;
+pub const INT_FAST16_MIN: i64 = -9223372036854775808;
+pub const INT_FAST32_MIN: i64 = -9223372036854775808;
+pub const INT_FAST8_MAX: u32 = 127;
+pub const INT_FAST16_MAX: u64 = 9223372036854775807;
+pub const INT_FAST32_MAX: u64 = 9223372036854775807;
+pub const UINT_FAST8_MAX: u32 = 255;
+pub const UINT_FAST16_MAX: i32 = -1;
+pub const UINT_FAST32_MAX: i32 = -1;
+pub const INTPTR_MIN: i64 = -9223372036854775808;
+pub const INTPTR_MAX: u64 = 9223372036854775807;
+pub const UINTPTR_MAX: i32 = -1;
+pub const PTRDIFF_MIN: i64 = -9223372036854775808;
+pub const PTRDIFF_MAX: u64 = 9223372036854775807;
+pub const SIG_ATOMIC_MIN: i32 = -2147483648;
+pub const SIG_ATOMIC_MAX: u32 = 2147483647;
+pub const SIZE_MAX: i32 = -1;
+pub const WINT_MIN: u32 = 0;
+pub const WINT_MAX: u32 = 4294967295;
+pub const ____gwchar_t_defined: u32 = 1;
+pub const __PRI64_PREFIX: &[u8; 2] = b"l\0";
+pub const __PRIPTR_PREFIX: &[u8; 2] = b"l\0";
+pub const PRId8: &[u8; 2] = b"d\0";
+pub const PRId16: &[u8; 2] = b"d\0";
+pub const PRId32: &[u8; 2] = b"d\0";
+pub const PRId64: &[u8; 3] = b"ld\0";
+pub const PRIdLEAST8: &[u8; 2] = b"d\0";
+pub const PRIdLEAST16: &[u8; 2] = b"d\0";
+pub const PRIdLEAST32: &[u8; 2] = b"d\0";
+pub const PRIdLEAST64: &[u8; 3] = b"ld\0";
+pub const PRIdFAST8: &[u8; 2] = b"d\0";
+pub const PRIdFAST16: &[u8; 3] = b"ld\0";
+pub const PRIdFAST32: &[u8; 3] = b"ld\0";
+pub const PRIdFAST64: &[u8; 3] = b"ld\0";
+pub const PRIi8: &[u8; 2] = b"i\0";
+pub const PRIi16: &[u8; 2] = b"i\0";
+pub const PRIi32: &[u8; 2] = b"i\0";
+pub const PRIi64: &[u8; 3] = b"li\0";
+pub const PRIiLEAST8: &[u8; 2] = b"i\0";
+pub const PRIiLEAST16: &[u8; 2] = b"i\0";
+pub const PRIiLEAST32: &[u8; 2] = b"i\0";
+pub const PRIiLEAST64: &[u8; 3] = b"li\0";
+pub const PRIiFAST8: &[u8; 2] = b"i\0";
+pub const PRIiFAST16: &[u8; 3] = b"li\0";
+pub const PRIiFAST32: &[u8; 3] = b"li\0";
+pub const PRIiFAST64: &[u8; 3] = b"li\0";
+pub const PRIo8: &[u8; 2] = b"o\0";
+pub const PRIo16: &[u8; 2] = b"o\0";
+pub const PRIo32: &[u8; 2] = b"o\0";
+pub const PRIo64: &[u8; 3] = b"lo\0";
+pub const PRIoLEAST8: &[u8; 2] = b"o\0";
+pub const PRIoLEAST16: &[u8; 2] = b"o\0";
+pub const PRIoLEAST32: &[u8; 2] = b"o\0";
+pub const PRIoLEAST64: &[u8; 3] = b"lo\0";
+pub const PRIoFAST8: &[u8; 2] = b"o\0";
+pub const PRIoFAST16: &[u8; 3] = b"lo\0";
+pub const PRIoFAST32: &[u8; 3] = b"lo\0";
+pub const PRIoFAST64: &[u8; 3] = b"lo\0";
+pub const PRIu8: &[u8; 2] = b"u\0";
+pub const PRIu16: &[u8; 2] = b"u\0";
+pub const PRIu32: &[u8; 2] = b"u\0";
+pub const PRIu64: &[u8; 3] = b"lu\0";
+pub const PRIuLEAST8: &[u8; 2] = b"u\0";
+pub const PRIuLEAST16: &[u8; 2] = b"u\0";
+pub const PRIuLEAST32: &[u8; 2] = b"u\0";
+pub const PRIuLEAST64: &[u8; 3] = b"lu\0";
+pub const PRIuFAST8: &[u8; 2] = b"u\0";
+pub const PRIuFAST16: &[u8; 3] = b"lu\0";
+pub const PRIuFAST32: &[u8; 3] = b"lu\0";
+pub const PRIuFAST64: &[u8; 3] = b"lu\0";
+pub const PRIx8: &[u8; 2] = b"x\0";
+pub const PRIx16: &[u8; 2] = b"x\0";
+pub const PRIx32: &[u8; 2] = b"x\0";
+pub const PRIx64: &[u8; 3] = b"lx\0";
+pub const PRIxLEAST8: &[u8; 2] = b"x\0";
+pub const PRIxLEAST16: &[u8; 2] = b"x\0";
+pub const PRIxLEAST32: &[u8; 2] = b"x\0";
+pub const PRIxLEAST64: &[u8; 3] = b"lx\0";
+pub const PRIxFAST8: &[u8; 2] = b"x\0";
+pub const PRIxFAST16: &[u8; 3] = b"lx\0";
+pub const PRIxFAST32: &[u8; 3] = b"lx\0";
+pub const PRIxFAST64: &[u8; 3] = b"lx\0";
+pub const PRIX8: &[u8; 2] = b"X\0";
+pub const PRIX16: &[u8; 2] = b"X\0";
+pub const PRIX32: &[u8; 2] = b"X\0";
+pub const PRIX64: &[u8; 3] = b"lX\0";
+pub const PRIXLEAST8: &[u8; 2] = b"X\0";
+pub const PRIXLEAST16: &[u8; 2] = b"X\0";
+pub const PRIXLEAST32: &[u8; 2] = b"X\0";
+pub const PRIXLEAST64: &[u8; 3] = b"lX\0";
+pub const PRIXFAST8: &[u8; 2] = b"X\0";
+pub const PRIXFAST16: &[u8; 3] = b"lX\0";
+pub const PRIXFAST32: &[u8; 3] = b"lX\0";
+pub const PRIXFAST64: &[u8; 3] = b"lX\0";
+pub const PRIdMAX: &[u8; 3] = b"ld\0";
+pub const PRIiMAX: &[u8; 3] = b"li\0";
+pub const PRIoMAX: &[u8; 3] = b"lo\0";
+pub const PRIuMAX: &[u8; 3] = b"lu\0";
+pub const PRIxMAX: &[u8; 3] = b"lx\0";
+pub const PRIXMAX: &[u8; 3] = b"lX\0";
+pub const PRIdPTR: &[u8; 3] = b"ld\0";
+pub const PRIiPTR: &[u8; 3] = b"li\0";
+pub const PRIoPTR: &[u8; 3] = b"lo\0";
+pub const PRIuPTR: &[u8; 3] = b"lu\0";
+pub const PRIxPTR: &[u8; 3] = b"lx\0";
+pub const PRIXPTR: &[u8; 3] = b"lX\0";
+pub const SCNd8: &[u8; 4] = b"hhd\0";
+pub const SCNd16: &[u8; 3] = b"hd\0";
+pub const SCNd32: &[u8; 2] = b"d\0";
+pub const SCNd64: &[u8; 3] = b"ld\0";
+pub const SCNdLEAST8: &[u8; 4] = b"hhd\0";
+pub const SCNdLEAST16: &[u8; 3] = b"hd\0";
+pub const SCNdLEAST32: &[u8; 2] = b"d\0";
+pub const SCNdLEAST64: &[u8; 3] = b"ld\0";
+pub const SCNdFAST8: &[u8; 4] = b"hhd\0";
+pub const SCNdFAST16: &[u8; 3] = b"ld\0";
+pub const SCNdFAST32: &[u8; 3] = b"ld\0";
+pub const SCNdFAST64: &[u8; 3] = b"ld\0";
+pub const SCNi8: &[u8; 4] = b"hhi\0";
+pub const SCNi16: &[u8; 3] = b"hi\0";
+pub const SCNi32: &[u8; 2] = b"i\0";
+pub const SCNi64: &[u8; 3] = b"li\0";
+pub const SCNiLEAST8: &[u8; 4] = b"hhi\0";
+pub const SCNiLEAST16: &[u8; 3] = b"hi\0";
+pub const SCNiLEAST32: &[u8; 2] = b"i\0";
+pub const SCNiLEAST64: &[u8; 3] = b"li\0";
+pub const SCNiFAST8: &[u8; 4] = b"hhi\0";
+pub const SCNiFAST16: &[u8; 3] = b"li\0";
+pub const SCNiFAST32: &[u8; 3] = b"li\0";
+pub const SCNiFAST64: &[u8; 3] = b"li\0";
+pub const SCNu8: &[u8; 4] = b"hhu\0";
+pub const SCNu16: &[u8; 3] = b"hu\0";
+pub const SCNu32: &[u8; 2] = b"u\0";
+pub const SCNu64: &[u8; 3] = b"lu\0";
+pub const SCNuLEAST8: &[u8; 4] = b"hhu\0";
+pub const SCNuLEAST16: &[u8; 3] = b"hu\0";
+pub const SCNuLEAST32: &[u8; 2] = b"u\0";
+pub const SCNuLEAST64: &[u8; 3] = b"lu\0";
+pub const SCNuFAST8: &[u8; 4] = b"hhu\0";
+pub const SCNuFAST16: &[u8; 3] = b"lu\0";
+pub const SCNuFAST32: &[u8; 3] = b"lu\0";
+pub const SCNuFAST64: &[u8; 3] = b"lu\0";
+pub const SCNo8: &[u8; 4] = b"hho\0";
+pub const SCNo16: &[u8; 3] = b"ho\0";
+pub const SCNo32: &[u8; 2] = b"o\0";
+pub const SCNo64: &[u8; 3] = b"lo\0";
+pub const SCNoLEAST8: &[u8; 4] = b"hho\0";
+pub const SCNoLEAST16: &[u8; 3] = b"ho\0";
+pub const SCNoLEAST32: &[u8; 2] = b"o\0";
+pub const SCNoLEAST64: &[u8; 3] = b"lo\0";
+pub const SCNoFAST8: &[u8; 4] = b"hho\0";
+pub const SCNoFAST16: &[u8; 3] = b"lo\0";
+pub const SCNoFAST32: &[u8; 3] = b"lo\0";
+pub const SCNoFAST64: &[u8; 3] = b"lo\0";
+pub const SCNx8: &[u8; 4] = b"hhx\0";
+pub const SCNx16: &[u8; 3] = b"hx\0";
+pub const SCNx32: &[u8; 2] = b"x\0";
+pub const SCNx64: &[u8; 3] = b"lx\0";
+pub const SCNxLEAST8: &[u8; 4] = b"hhx\0";
+pub const SCNxLEAST16: &[u8; 3] = b"hx\0";
+pub const SCNxLEAST32: &[u8; 2] = b"x\0";
+pub const SCNxLEAST64: &[u8; 3] = b"lx\0";
+pub const SCNxFAST8: &[u8; 4] = b"hhx\0";
+pub const SCNxFAST16: &[u8; 3] = b"lx\0";
+pub const SCNxFAST32: &[u8; 3] = b"lx\0";
+pub const SCNxFAST64: &[u8; 3] = b"lx\0";
+pub const SCNdMAX: &[u8; 3] = b"ld\0";
+pub const SCNiMAX: &[u8; 3] = b"li\0";
+pub const SCNoMAX: &[u8; 3] = b"lo\0";
+pub const SCNuMAX: &[u8; 3] = b"lu\0";
+pub const SCNxMAX: &[u8; 3] = b"lx\0";
+pub const SCNdPTR: &[u8; 3] = b"ld\0";
+pub const SCNiPTR: &[u8; 3] = b"li\0";
+pub const SCNoPTR: &[u8; 3] = b"lo\0";
+pub const SCNuPTR: &[u8; 3] = b"lu\0";
+pub const SCNxPTR: &[u8; 3] = b"lx\0";
+pub const _STDIO_H: u32 = 1;
+pub const _____fpos_t_defined: u32 = 1;
+pub const ____mbstate_t_defined: u32 = 1;
+pub const _____fpos64_t_defined: u32 = 1;
+pub const ____FILE_defined: u32 = 1;
+pub const __FILE_defined: u32 = 1;
+pub const __struct_FILE_defined: u32 = 1;
+pub const _IO_EOF_SEEN: u32 = 16;
+pub const _IO_ERR_SEEN: u32 = 32;
+pub const _IO_USER_LOCK: u32 = 32768;
+pub const __cookie_io_functions_t_defined: u32 = 1;
+pub const _IOFBF: u32 = 0;
+pub const _IOLBF: u32 = 1;
+pub const _IONBF: u32 = 2;
+pub const BUFSIZ: u32 = 8192;
+pub const EOF: i32 = -1;
+pub const SEEK_SET: u32 = 0;
+pub const SEEK_CUR: u32 = 1;
+pub const SEEK_END: u32 = 2;
+pub const P_tmpdir: &[u8; 5] = b"/tmp\0";
+pub const L_tmpnam: u32 = 20;
+pub const TMP_MAX: u32 = 238328;
+pub const _BITS_STDIO_LIM_H: u32 = 1;
+pub const FILENAME_MAX: u32 = 4096;
+pub const L_ctermid: u32 = 9;
+pub const FOPEN_MAX: u32 = 16;
+pub const __HAVE_FLOAT128: u32 = 0;
+pub const __HAVE_DISTINCT_FLOAT128: u32 = 0;
+pub const __HAVE_FLOAT64X: u32 = 1;
+pub const __HAVE_FLOAT64X_LONG_DOUBLE: u32 = 1;
+pub const __HAVE_FLOAT16: u32 = 0;
+pub const __HAVE_FLOAT32: u32 = 1;
+pub const __HAVE_FLOAT64: u32 = 1;
+pub const __HAVE_FLOAT32X: u32 = 1;
+pub const __HAVE_FLOAT128X: u32 = 0;
+pub const __HAVE_DISTINCT_FLOAT16: u32 = 0;
+pub const __HAVE_DISTINCT_FLOAT32: u32 = 0;
+pub const __HAVE_DISTINCT_FLOAT64: u32 = 0;
+pub const __HAVE_DISTINCT_FLOAT32X: u32 = 0;
+pub const __HAVE_DISTINCT_FLOAT64X: u32 = 0;
+pub const __HAVE_DISTINCT_FLOAT128X: u32 = 0;
+pub const __HAVE_FLOATN_NOT_TYPEDEF: u32 = 0;
+pub const _CTYPE_H: u32 = 1;
+pub const _BITS_ENDIAN_H: u32 = 1;
+pub const __LITTLE_ENDIAN: u32 = 1234;
+pub const __BIG_ENDIAN: u32 = 4321;
+pub const __PDP_ENDIAN: u32 = 3412;
+pub const _BITS_ENDIANNESS_H: u32 = 1;
+pub const __BYTE_ORDER: u32 = 1234;
+pub const __FLOAT_WORD_ORDER: u32 = 1234;
+pub const _BITS_TYPES_LOCALE_T_H: u32 = 1;
+pub const _BITS_TYPES___LOCALE_T_H: u32 = 1;
+pub const _ASSERT_H: u32 = 1;
+pub const _STRING_H: u32 = 1;
+pub const _STRINGS_H: u32 = 1;
+pub const NDB_PACKED_STR: u32 = 1;
+pub const NDB_PACKED_ID: u32 = 2;
+pub const NDB_FLAG_NOMIGRATE: u32 = 1;
+pub const NDB_FLAG_SKIP_NOTE_VERIFY: u32 = 2;
+pub const NDB_NUM_FILTERS: u32 = 7;
+pub const MAX_TEXT_SEARCH_RESULTS: u32 = 128;
+pub const MAX_TEXT_SEARCH_WORDS: u32 = 8;
+pub type __u_char = ::std::os::raw::c_uchar;
+pub type __u_short = ::std::os::raw::c_ushort;
+pub type __u_int = ::std::os::raw::c_uint;
+pub type __u_long = ::std::os::raw::c_ulong;
+pub type __int8_t = ::std::os::raw::c_schar;
+pub type __uint8_t = ::std::os::raw::c_uchar;
+pub type __int16_t = ::std::os::raw::c_short;
+pub type __uint16_t = ::std::os::raw::c_ushort;
+pub type __int32_t = ::std::os::raw::c_int;
+pub type __uint32_t = ::std::os::raw::c_uint;
+pub type __int64_t = ::std::os::raw::c_long;
+pub type __uint64_t = ::std::os::raw::c_ulong;
+pub type __int_least8_t = __int8_t;
+pub type __uint_least8_t = __uint8_t;
+pub type __int_least16_t = __int16_t;
+pub type __uint_least16_t = __uint16_t;
+pub type __int_least32_t = __int32_t;
+pub type __uint_least32_t = __uint32_t;
+pub type __int_least64_t = __int64_t;
+pub type __uint_least64_t = __uint64_t;
+pub type __quad_t = ::std::os::raw::c_long;
+pub type __u_quad_t = ::std::os::raw::c_ulong;
+pub type __intmax_t = ::std::os::raw::c_long;
+pub type __uintmax_t = ::std::os::raw::c_ulong;
+pub type __dev_t = ::std::os::raw::c_ulong;
+pub type __uid_t = ::std::os::raw::c_uint;
+pub type __gid_t = ::std::os::raw::c_uint;
+pub type __ino_t = ::std::os::raw::c_ulong;
+pub type __ino64_t = ::std::os::raw::c_ulong;
+pub type __mode_t = ::std::os::raw::c_uint;
+pub type __nlink_t = ::std::os::raw::c_ulong;
+pub type __off_t = ::std::os::raw::c_long;
+pub type __off64_t = ::std::os::raw::c_long;
+pub type __pid_t = ::std::os::raw::c_int;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct __fsid_t {
+ pub __val: [::std::os::raw::c_int; 2usize],
+}
+#[test]
+fn bindgen_test_layout___fsid_t() {
+ const UNINIT: ::std::mem::MaybeUninit<__fsid_t> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<__fsid_t>(),
+ 8usize,
+ concat!("Size of: ", stringify!(__fsid_t))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<__fsid_t>(),
+ 4usize,
+ concat!("Alignment of ", stringify!(__fsid_t))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).__val) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(__fsid_t),
+ "::",
+ stringify!(__val)
+ )
+ );
+}
+pub type __clock_t = ::std::os::raw::c_long;
+pub type __rlim_t = ::std::os::raw::c_ulong;
+pub type __rlim64_t = ::std::os::raw::c_ulong;
+pub type __id_t = ::std::os::raw::c_uint;
+pub type __time_t = ::std::os::raw::c_long;
+pub type __useconds_t = ::std::os::raw::c_uint;
+pub type __suseconds_t = ::std::os::raw::c_long;
+pub type __suseconds64_t = ::std::os::raw::c_long;
+pub type __daddr_t = ::std::os::raw::c_int;
+pub type __key_t = ::std::os::raw::c_int;
+pub type __clockid_t = ::std::os::raw::c_int;
+pub type __timer_t = *mut ::std::os::raw::c_void;
+pub type __blksize_t = ::std::os::raw::c_long;
+pub type __blkcnt_t = ::std::os::raw::c_long;
+pub type __blkcnt64_t = ::std::os::raw::c_long;
+pub type __fsblkcnt_t = ::std::os::raw::c_ulong;
+pub type __fsblkcnt64_t = ::std::os::raw::c_ulong;
+pub type __fsfilcnt_t = ::std::os::raw::c_ulong;
+pub type __fsfilcnt64_t = ::std::os::raw::c_ulong;
+pub type __fsword_t = ::std::os::raw::c_long;
+pub type __ssize_t = ::std::os::raw::c_long;
+pub type __syscall_slong_t = ::std::os::raw::c_long;
+pub type __syscall_ulong_t = ::std::os::raw::c_ulong;
+pub type __loff_t = __off64_t;
+pub type __caddr_t = *mut ::std::os::raw::c_char;
+pub type __intptr_t = ::std::os::raw::c_long;
+pub type __socklen_t = ::std::os::raw::c_uint;
+pub type __sig_atomic_t = ::std::os::raw::c_int;
+pub type int_least8_t = __int_least8_t;
+pub type int_least16_t = __int_least16_t;
+pub type int_least32_t = __int_least32_t;
+pub type int_least64_t = __int_least64_t;
+pub type uint_least8_t = __uint_least8_t;
+pub type uint_least16_t = __uint_least16_t;
+pub type uint_least32_t = __uint_least32_t;
+pub type uint_least64_t = __uint_least64_t;
+pub type int_fast8_t = ::std::os::raw::c_schar;
+pub type int_fast16_t = ::std::os::raw::c_long;
+pub type int_fast32_t = ::std::os::raw::c_long;
+pub type int_fast64_t = ::std::os::raw::c_long;
+pub type uint_fast8_t = ::std::os::raw::c_uchar;
+pub type uint_fast16_t = ::std::os::raw::c_ulong;
+pub type uint_fast32_t = ::std::os::raw::c_ulong;
+pub type uint_fast64_t = ::std::os::raw::c_ulong;
+pub type intmax_t = __intmax_t;
+pub type uintmax_t = __uintmax_t;
+pub type __gwchar_t = ::std::os::raw::c_int;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct imaxdiv_t {
+ pub quot: ::std::os::raw::c_long,
+ pub rem: ::std::os::raw::c_long,
+}
+#[test]
+fn bindgen_test_layout_imaxdiv_t() {
+ const UNINIT: ::std::mem::MaybeUninit<imaxdiv_t> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<imaxdiv_t>(),
+ 16usize,
+ concat!("Size of: ", stringify!(imaxdiv_t))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<imaxdiv_t>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(imaxdiv_t))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).quot) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(imaxdiv_t),
+ "::",
+ stringify!(quot)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).rem) as usize - ptr as usize },
+ 8usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(imaxdiv_t),
+ "::",
+ stringify!(rem)
+ )
+ );
+}
+extern "C" {
+ pub fn imaxabs(__n: intmax_t) -> intmax_t;
+}
+extern "C" {
+ pub fn imaxdiv(__numer: intmax_t, __denom: intmax_t) -> imaxdiv_t;
+}
+extern "C" {
+ pub fn strtoimax(
+ __nptr: *const ::std::os::raw::c_char,
+ __endptr: *mut *mut ::std::os::raw::c_char,
+ __base: ::std::os::raw::c_int,
+ ) -> intmax_t;
+}
+extern "C" {
+ pub fn strtoumax(
+ __nptr: *const ::std::os::raw::c_char,
+ __endptr: *mut *mut ::std::os::raw::c_char,
+ __base: ::std::os::raw::c_int,
+ ) -> uintmax_t;
+}
+extern "C" {
+ pub fn wcstoimax(
+ __nptr: *const __gwchar_t,
+ __endptr: *mut *mut __gwchar_t,
+ __base: ::std::os::raw::c_int,
+ ) -> intmax_t;
+}
+extern "C" {
+ pub fn wcstoumax(
+ __nptr: *const __gwchar_t,
+ __endptr: *mut *mut __gwchar_t,
+ __base: ::std::os::raw::c_int,
+ ) -> uintmax_t;
+}
+pub type u8_ = ::std::os::raw::c_uchar;
+pub type u32_ = ::std::os::raw::c_uint;
+pub type u16_ = ::std::os::raw::c_ushort;
+pub type u64_ = u64;
+pub type s64 = i64;
+pub type __gnuc_va_list = __builtin_va_list;
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct __mbstate_t {
+ pub __count: ::std::os::raw::c_int,
+ pub __value: __mbstate_t__bindgen_ty_1,
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub union __mbstate_t__bindgen_ty_1 {
+ pub __wch: ::std::os::raw::c_uint,
+ pub __wchb: [::std::os::raw::c_char; 4usize],
+}
+#[test]
+fn bindgen_test_layout___mbstate_t__bindgen_ty_1() {
+ const UNINIT: ::std::mem::MaybeUninit<__mbstate_t__bindgen_ty_1> =
+ ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<__mbstate_t__bindgen_ty_1>(),
+ 4usize,
+ concat!("Size of: ", stringify!(__mbstate_t__bindgen_ty_1))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<__mbstate_t__bindgen_ty_1>(),
+ 4usize,
+ concat!("Alignment of ", stringify!(__mbstate_t__bindgen_ty_1))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).__wch) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(__mbstate_t__bindgen_ty_1),
+ "::",
+ stringify!(__wch)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).__wchb) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(__mbstate_t__bindgen_ty_1),
+ "::",
+ stringify!(__wchb)
+ )
+ );
+}
+#[test]
+fn bindgen_test_layout___mbstate_t() {
+ const UNINIT: ::std::mem::MaybeUninit<__mbstate_t> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<__mbstate_t>(),
+ 8usize,
+ concat!("Size of: ", stringify!(__mbstate_t))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<__mbstate_t>(),
+ 4usize,
+ concat!("Alignment of ", stringify!(__mbstate_t))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).__count) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(__mbstate_t),
+ "::",
+ stringify!(__count)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).__value) as usize - ptr as usize },
+ 4usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(__mbstate_t),
+ "::",
+ stringify!(__value)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct _G_fpos_t {
+ pub __pos: __off_t,
+ pub __state: __mbstate_t,
+}
+#[test]
+fn bindgen_test_layout__G_fpos_t() {
+ const UNINIT: ::std::mem::MaybeUninit<_G_fpos_t> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<_G_fpos_t>(),
+ 16usize,
+ concat!("Size of: ", stringify!(_G_fpos_t))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<_G_fpos_t>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(_G_fpos_t))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_G_fpos_t),
+ "::",
+ stringify!(__pos)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize },
+ 8usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_G_fpos_t),
+ "::",
+ stringify!(__state)
+ )
+ );
+}
+pub type __fpos_t = _G_fpos_t;
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct _G_fpos64_t {
+ pub __pos: __off64_t,
+ pub __state: __mbstate_t,
+}
+#[test]
+fn bindgen_test_layout__G_fpos64_t() {
+ const UNINIT: ::std::mem::MaybeUninit<_G_fpos64_t> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<_G_fpos64_t>(),
+ 16usize,
+ concat!("Size of: ", stringify!(_G_fpos64_t))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<_G_fpos64_t>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(_G_fpos64_t))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).__pos) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_G_fpos64_t),
+ "::",
+ stringify!(__pos)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).__state) as usize - ptr as usize },
+ 8usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_G_fpos64_t),
+ "::",
+ stringify!(__state)
+ )
+ );
+}
+pub type __fpos64_t = _G_fpos64_t;
+pub type __FILE = _IO_FILE;
+pub type FILE = _IO_FILE;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct _IO_marker {
+ _unused: [u8; 0],
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct _IO_codecvt {
+ _unused: [u8; 0],
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct _IO_wide_data {
+ _unused: [u8; 0],
+}
+pub type _IO_lock_t = ::std::os::raw::c_void;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct _IO_FILE {
+ pub _flags: ::std::os::raw::c_int,
+ pub _IO_read_ptr: *mut ::std::os::raw::c_char,
+ pub _IO_read_end: *mut ::std::os::raw::c_char,
+ pub _IO_read_base: *mut ::std::os::raw::c_char,
+ pub _IO_write_base: *mut ::std::os::raw::c_char,
+ pub _IO_write_ptr: *mut ::std::os::raw::c_char,
+ pub _IO_write_end: *mut ::std::os::raw::c_char,
+ pub _IO_buf_base: *mut ::std::os::raw::c_char,
+ pub _IO_buf_end: *mut ::std::os::raw::c_char,
+ pub _IO_save_base: *mut ::std::os::raw::c_char,
+ pub _IO_backup_base: *mut ::std::os::raw::c_char,
+ pub _IO_save_end: *mut ::std::os::raw::c_char,
+ pub _markers: *mut _IO_marker,
+ pub _chain: *mut _IO_FILE,
+ pub _fileno: ::std::os::raw::c_int,
+ pub _flags2: ::std::os::raw::c_int,
+ pub _old_offset: __off_t,
+ pub _cur_column: ::std::os::raw::c_ushort,
+ pub _vtable_offset: ::std::os::raw::c_schar,
+ pub _shortbuf: [::std::os::raw::c_char; 1usize],
+ pub _lock: *mut _IO_lock_t,
+ pub _offset: __off64_t,
+ pub _codecvt: *mut _IO_codecvt,
+ pub _wide_data: *mut _IO_wide_data,
+ pub _freeres_list: *mut _IO_FILE,
+ pub _freeres_buf: *mut ::std::os::raw::c_void,
+ pub __pad5: usize,
+ pub _mode: ::std::os::raw::c_int,
+ pub _unused2: [::std::os::raw::c_char; 20usize],
+}
+#[test]
+fn bindgen_test_layout__IO_FILE() {
+ const UNINIT: ::std::mem::MaybeUninit<_IO_FILE> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<_IO_FILE>(),
+ 216usize,
+ concat!("Size of: ", stringify!(_IO_FILE))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<_IO_FILE>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(_IO_FILE))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._flags) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_flags)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_ptr) as usize - ptr as usize },
+ 8usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_IO_read_ptr)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_end) as usize - ptr as usize },
+ 16usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_IO_read_end)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._IO_read_base) as usize - ptr as usize },
+ 24usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_IO_read_base)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_base) as usize - ptr as usize },
+ 32usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_IO_write_base)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_ptr) as usize - ptr as usize },
+ 40usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_IO_write_ptr)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._IO_write_end) as usize - ptr as usize },
+ 48usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_IO_write_end)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._IO_buf_base) as usize - ptr as usize },
+ 56usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_IO_buf_base)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._IO_buf_end) as usize - ptr as usize },
+ 64usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_IO_buf_end)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._IO_save_base) as usize - ptr as usize },
+ 72usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_IO_save_base)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._IO_backup_base) as usize - ptr as usize },
+ 80usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_IO_backup_base)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._IO_save_end) as usize - ptr as usize },
+ 88usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_IO_save_end)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._markers) as usize - ptr as usize },
+ 96usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_markers)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._chain) as usize - ptr as usize },
+ 104usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_chain)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._fileno) as usize - ptr as usize },
+ 112usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_fileno)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._flags2) as usize - ptr as usize },
+ 116usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_flags2)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._old_offset) as usize - ptr as usize },
+ 120usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_old_offset)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._cur_column) as usize - ptr as usize },
+ 128usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_cur_column)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._vtable_offset) as usize - ptr as usize },
+ 130usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_vtable_offset)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._shortbuf) as usize - ptr as usize },
+ 131usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_shortbuf)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._lock) as usize - ptr as usize },
+ 136usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_lock)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._offset) as usize - ptr as usize },
+ 144usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_offset)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._codecvt) as usize - ptr as usize },
+ 152usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_codecvt)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._wide_data) as usize - ptr as usize },
+ 160usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_wide_data)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._freeres_list) as usize - ptr as usize },
+ 168usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_freeres_list)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._freeres_buf) as usize - ptr as usize },
+ 176usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_freeres_buf)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).__pad5) as usize - ptr as usize },
+ 184usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(__pad5)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._mode) as usize - ptr as usize },
+ 192usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_mode)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr)._unused2) as usize - ptr as usize },
+ 196usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_FILE),
+ "::",
+ stringify!(_unused2)
+ )
+ );
+}
+pub type cookie_read_function_t = ::std::option::Option<
+ unsafe extern "C" fn(
+ __cookie: *mut ::std::os::raw::c_void,
+ __buf: *mut ::std::os::raw::c_char,
+ __nbytes: usize,
+ ) -> __ssize_t,
+>;
+pub type cookie_write_function_t = ::std::option::Option<
+ unsafe extern "C" fn(
+ __cookie: *mut ::std::os::raw::c_void,
+ __buf: *const ::std::os::raw::c_char,
+ __nbytes: usize,
+ ) -> __ssize_t,
+>;
+pub type cookie_seek_function_t = ::std::option::Option<
+ unsafe extern "C" fn(
+ __cookie: *mut ::std::os::raw::c_void,
+ __pos: *mut __off64_t,
+ __w: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int,
+>;
+pub type cookie_close_function_t = ::std::option::Option<
+ unsafe extern "C" fn(__cookie: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int,
+>;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct _IO_cookie_io_functions_t {
+ pub read: cookie_read_function_t,
+ pub write: cookie_write_function_t,
+ pub seek: cookie_seek_function_t,
+ pub close: cookie_close_function_t,
+}
+#[test]
+fn bindgen_test_layout__IO_cookie_io_functions_t() {
+ const UNINIT: ::std::mem::MaybeUninit<_IO_cookie_io_functions_t> =
+ ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<_IO_cookie_io_functions_t>(),
+ 32usize,
+ concat!("Size of: ", stringify!(_IO_cookie_io_functions_t))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<_IO_cookie_io_functions_t>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(_IO_cookie_io_functions_t))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).read) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_cookie_io_functions_t),
+ "::",
+ stringify!(read)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).write) as usize - ptr as usize },
+ 8usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_cookie_io_functions_t),
+ "::",
+ stringify!(write)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).seek) as usize - ptr as usize },
+ 16usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_cookie_io_functions_t),
+ "::",
+ stringify!(seek)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).close) as usize - ptr as usize },
+ 24usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(_IO_cookie_io_functions_t),
+ "::",
+ stringify!(close)
+ )
+ );
+}
+pub type cookie_io_functions_t = _IO_cookie_io_functions_t;
+pub type va_list = __gnuc_va_list;
+pub type off_t = __off_t;
+pub type fpos_t = __fpos_t;
+extern "C" {
+ pub static mut stdin: *mut FILE;
+}
+extern "C" {
+ pub static mut stdout: *mut FILE;
+}
+extern "C" {
+ pub static mut stderr: *mut FILE;
+}
+extern "C" {
+ pub fn remove(__filename: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn rename(
+ __old: *const ::std::os::raw::c_char,
+ __new: *const ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn renameat(
+ __oldfd: ::std::os::raw::c_int,
+ __old: *const ::std::os::raw::c_char,
+ __newfd: ::std::os::raw::c_int,
+ __new: *const ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fclose(__stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn tmpfile() -> *mut FILE;
+}
+extern "C" {
+ pub fn tmpnam(arg1: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn tmpnam_r(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn tempnam(
+ __dir: *const ::std::os::raw::c_char,
+ __pfx: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn fflush(__stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fflush_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fopen(
+ __filename: *const ::std::os::raw::c_char,
+ __modes: *const ::std::os::raw::c_char,
+ ) -> *mut FILE;
+}
+extern "C" {
+ pub fn freopen(
+ __filename: *const ::std::os::raw::c_char,
+ __modes: *const ::std::os::raw::c_char,
+ __stream: *mut FILE,
+ ) -> *mut FILE;
+}
+extern "C" {
+ pub fn fdopen(__fd: ::std::os::raw::c_int, __modes: *const ::std::os::raw::c_char)
+ -> *mut FILE;
+}
+extern "C" {
+ pub fn fopencookie(
+ __magic_cookie: *mut ::std::os::raw::c_void,
+ __modes: *const ::std::os::raw::c_char,
+ __io_funcs: cookie_io_functions_t,
+ ) -> *mut FILE;
+}
+extern "C" {
+ pub fn fmemopen(
+ __s: *mut ::std::os::raw::c_void,
+ __len: usize,
+ __modes: *const ::std::os::raw::c_char,
+ ) -> *mut FILE;
+}
+extern "C" {
+ pub fn open_memstream(
+ __bufloc: *mut *mut ::std::os::raw::c_char,
+ __sizeloc: *mut usize,
+ ) -> *mut FILE;
+}
+extern "C" {
+ pub fn setbuf(__stream: *mut FILE, __buf: *mut ::std::os::raw::c_char);
+}
+extern "C" {
+ pub fn setvbuf(
+ __stream: *mut FILE,
+ __buf: *mut ::std::os::raw::c_char,
+ __modes: ::std::os::raw::c_int,
+ __n: usize,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn setbuffer(__stream: *mut FILE, __buf: *mut ::std::os::raw::c_char, __size: usize);
+}
+extern "C" {
+ pub fn setlinebuf(__stream: *mut FILE);
+}
+extern "C" {
+ pub fn fprintf(
+ __stream: *mut FILE,
+ __format: *const ::std::os::raw::c_char,
+ ...
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn printf(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn sprintf(
+ __s: *mut ::std::os::raw::c_char,
+ __format: *const ::std::os::raw::c_char,
+ ...
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn vfprintf(
+ __s: *mut FILE,
+ __format: *const ::std::os::raw::c_char,
+ __arg: *mut __va_list_tag,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn vprintf(
+ __format: *const ::std::os::raw::c_char,
+ __arg: *mut __va_list_tag,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn vsprintf(
+ __s: *mut ::std::os::raw::c_char,
+ __format: *const ::std::os::raw::c_char,
+ __arg: *mut __va_list_tag,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn snprintf(
+ __s: *mut ::std::os::raw::c_char,
+ __maxlen: ::std::os::raw::c_ulong,
+ __format: *const ::std::os::raw::c_char,
+ ...
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn vsnprintf(
+ __s: *mut ::std::os::raw::c_char,
+ __maxlen: ::std::os::raw::c_ulong,
+ __format: *const ::std::os::raw::c_char,
+ __arg: *mut __va_list_tag,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn vasprintf(
+ __ptr: *mut *mut ::std::os::raw::c_char,
+ __f: *const ::std::os::raw::c_char,
+ __arg: *mut __va_list_tag,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn __asprintf(
+ __ptr: *mut *mut ::std::os::raw::c_char,
+ __fmt: *const ::std::os::raw::c_char,
+ ...
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn asprintf(
+ __ptr: *mut *mut ::std::os::raw::c_char,
+ __fmt: *const ::std::os::raw::c_char,
+ ...
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn vdprintf(
+ __fd: ::std::os::raw::c_int,
+ __fmt: *const ::std::os::raw::c_char,
+ __arg: *mut __va_list_tag,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn dprintf(
+ __fd: ::std::os::raw::c_int,
+ __fmt: *const ::std::os::raw::c_char,
+ ...
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fscanf(
+ __stream: *mut FILE,
+ __format: *const ::std::os::raw::c_char,
+ ...
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn scanf(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn sscanf(
+ __s: *const ::std::os::raw::c_char,
+ __format: *const ::std::os::raw::c_char,
+ ...
+ ) -> ::std::os::raw::c_int;
+}
+pub type _Float32 = f32;
+pub type _Float64 = f64;
+pub type _Float32x = f64;
+pub type _Float64x = u128;
+extern "C" {
+ #[link_name = "\u{1}__isoc99_fscanf"]
+ pub fn fscanf1(
+ __stream: *mut FILE,
+ __format: *const ::std::os::raw::c_char,
+ ...
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "\u{1}__isoc99_scanf"]
+ pub fn scanf1(__format: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "\u{1}__isoc99_sscanf"]
+ pub fn sscanf1(
+ __s: *const ::std::os::raw::c_char,
+ __format: *const ::std::os::raw::c_char,
+ ...
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn vfscanf(
+ __s: *mut FILE,
+ __format: *const ::std::os::raw::c_char,
+ __arg: *mut __va_list_tag,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn vscanf(
+ __format: *const ::std::os::raw::c_char,
+ __arg: *mut __va_list_tag,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn vsscanf(
+ __s: *const ::std::os::raw::c_char,
+ __format: *const ::std::os::raw::c_char,
+ __arg: *mut __va_list_tag,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "\u{1}__isoc99_vfscanf"]
+ pub fn vfscanf1(
+ __s: *mut FILE,
+ __format: *const ::std::os::raw::c_char,
+ __arg: *mut __va_list_tag,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "\u{1}__isoc99_vscanf"]
+ pub fn vscanf1(
+ __format: *const ::std::os::raw::c_char,
+ __arg: *mut __va_list_tag,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ #[link_name = "\u{1}__isoc99_vsscanf"]
+ pub fn vsscanf1(
+ __s: *const ::std::os::raw::c_char,
+ __format: *const ::std::os::raw::c_char,
+ __arg: *mut __va_list_tag,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fgetc(__stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn getc(__stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn getchar() -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn getc_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn getchar_unlocked() -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fgetc_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fputc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn putc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn putchar(__c: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fputc_unlocked(__c: ::std::os::raw::c_int, __stream: *mut FILE)
+ -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn putc_unlocked(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn putchar_unlocked(__c: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn getw(__stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn putw(__w: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fgets(
+ __s: *mut ::std::os::raw::c_char,
+ __n: ::std::os::raw::c_int,
+ __stream: *mut FILE,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn __getdelim(
+ __lineptr: *mut *mut ::std::os::raw::c_char,
+ __n: *mut usize,
+ __delimiter: ::std::os::raw::c_int,
+ __stream: *mut FILE,
+ ) -> __ssize_t;
+}
+extern "C" {
+ pub fn getdelim(
+ __lineptr: *mut *mut ::std::os::raw::c_char,
+ __n: *mut usize,
+ __delimiter: ::std::os::raw::c_int,
+ __stream: *mut FILE,
+ ) -> __ssize_t;
+}
+extern "C" {
+ pub fn getline(
+ __lineptr: *mut *mut ::std::os::raw::c_char,
+ __n: *mut usize,
+ __stream: *mut FILE,
+ ) -> __ssize_t;
+}
+extern "C" {
+ pub fn fputs(__s: *const ::std::os::raw::c_char, __stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn puts(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ungetc(__c: ::std::os::raw::c_int, __stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fread(
+ __ptr: *mut ::std::os::raw::c_void,
+ __size: ::std::os::raw::c_ulong,
+ __n: ::std::os::raw::c_ulong,
+ __stream: *mut FILE,
+ ) -> ::std::os::raw::c_ulong;
+}
+extern "C" {
+ pub fn fwrite(
+ __ptr: *const ::std::os::raw::c_void,
+ __size: ::std::os::raw::c_ulong,
+ __n: ::std::os::raw::c_ulong,
+ __s: *mut FILE,
+ ) -> ::std::os::raw::c_ulong;
+}
+extern "C" {
+ pub fn fread_unlocked(
+ __ptr: *mut ::std::os::raw::c_void,
+ __size: usize,
+ __n: usize,
+ __stream: *mut FILE,
+ ) -> usize;
+}
+extern "C" {
+ pub fn fwrite_unlocked(
+ __ptr: *const ::std::os::raw::c_void,
+ __size: usize,
+ __n: usize,
+ __stream: *mut FILE,
+ ) -> usize;
+}
+extern "C" {
+ pub fn fseek(
+ __stream: *mut FILE,
+ __off: ::std::os::raw::c_long,
+ __whence: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ftell(__stream: *mut FILE) -> ::std::os::raw::c_long;
+}
+extern "C" {
+ pub fn rewind(__stream: *mut FILE);
+}
+extern "C" {
+ pub fn fseeko(
+ __stream: *mut FILE,
+ __off: __off_t,
+ __whence: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ftello(__stream: *mut FILE) -> __off_t;
+}
+extern "C" {
+ pub fn fgetpos(__stream: *mut FILE, __pos: *mut fpos_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fsetpos(__stream: *mut FILE, __pos: *const fpos_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn clearerr(__stream: *mut FILE);
+}
+extern "C" {
+ pub fn feof(__stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ferror(__stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn clearerr_unlocked(__stream: *mut FILE);
+}
+extern "C" {
+ pub fn feof_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ferror_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn perror(__s: *const ::std::os::raw::c_char);
+}
+extern "C" {
+ pub fn fileno(__stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fileno_unlocked(__stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn pclose(__stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn popen(
+ __command: *const ::std::os::raw::c_char,
+ __modes: *const ::std::os::raw::c_char,
+ ) -> *mut FILE;
+}
+extern "C" {
+ pub fn ctermid(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn flockfile(__stream: *mut FILE);
+}
+extern "C" {
+ pub fn ftrylockfile(__stream: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn funlockfile(__stream: *mut FILE);
+}
+extern "C" {
+ pub fn __uflow(arg1: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn __overflow(arg1: *mut FILE, arg2: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+pub const _ISupper: _bindgen_ty_1 = 256;
+pub const _ISlower: _bindgen_ty_1 = 512;
+pub const _ISalpha: _bindgen_ty_1 = 1024;
+pub const _ISdigit: _bindgen_ty_1 = 2048;
+pub const _ISxdigit: _bindgen_ty_1 = 4096;
+pub const _ISspace: _bindgen_ty_1 = 8192;
+pub const _ISprint: _bindgen_ty_1 = 16384;
+pub const _ISgraph: _bindgen_ty_1 = 32768;
+pub const _ISblank: _bindgen_ty_1 = 1;
+pub const _IScntrl: _bindgen_ty_1 = 2;
+pub const _ISpunct: _bindgen_ty_1 = 4;
+pub const _ISalnum: _bindgen_ty_1 = 8;
+pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
+extern "C" {
+ pub fn __ctype_b_loc() -> *mut *const ::std::os::raw::c_ushort;
+}
+extern "C" {
+ pub fn __ctype_tolower_loc() -> *mut *const __int32_t;
+}
+extern "C" {
+ pub fn __ctype_toupper_loc() -> *mut *const __int32_t;
+}
+extern "C" {
+ pub fn isalnum(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isalpha(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn iscntrl(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isdigit(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn islower(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isgraph(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isprint(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ispunct(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isspace(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isupper(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isxdigit(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn tolower(__c: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn toupper(__c: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isblank(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isascii(__c: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn toascii(__c: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn _toupper(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn _tolower(arg1: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct __locale_struct {
+ pub __locales: [*mut __locale_data; 13usize],
+ pub __ctype_b: *const ::std::os::raw::c_ushort,
+ pub __ctype_tolower: *const ::std::os::raw::c_int,
+ pub __ctype_toupper: *const ::std::os::raw::c_int,
+ pub __names: [*const ::std::os::raw::c_char; 13usize],
+}
+#[test]
+fn bindgen_test_layout___locale_struct() {
+ const UNINIT: ::std::mem::MaybeUninit<__locale_struct> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<__locale_struct>(),
+ 232usize,
+ concat!("Size of: ", stringify!(__locale_struct))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<__locale_struct>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(__locale_struct))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).__locales) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(__locale_struct),
+ "::",
+ stringify!(__locales)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).__ctype_b) as usize - ptr as usize },
+ 104usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(__locale_struct),
+ "::",
+ stringify!(__ctype_b)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).__ctype_tolower) as usize - ptr as usize },
+ 112usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(__locale_struct),
+ "::",
+ stringify!(__ctype_tolower)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).__ctype_toupper) as usize - ptr as usize },
+ 120usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(__locale_struct),
+ "::",
+ stringify!(__ctype_toupper)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).__names) as usize - ptr as usize },
+ 128usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(__locale_struct),
+ "::",
+ stringify!(__names)
+ )
+ );
+}
+pub type __locale_t = *mut __locale_struct;
+pub type locale_t = __locale_t;
+extern "C" {
+ pub fn isalnum_l(arg1: ::std::os::raw::c_int, arg2: locale_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isalpha_l(arg1: ::std::os::raw::c_int, arg2: locale_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn iscntrl_l(arg1: ::std::os::raw::c_int, arg2: locale_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isdigit_l(arg1: ::std::os::raw::c_int, arg2: locale_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn islower_l(arg1: ::std::os::raw::c_int, arg2: locale_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isgraph_l(arg1: ::std::os::raw::c_int, arg2: locale_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isprint_l(arg1: ::std::os::raw::c_int, arg2: locale_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ispunct_l(arg1: ::std::os::raw::c_int, arg2: locale_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isspace_l(arg1: ::std::os::raw::c_int, arg2: locale_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isupper_l(arg1: ::std::os::raw::c_int, arg2: locale_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isxdigit_l(arg1: ::std::os::raw::c_int, arg2: locale_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isblank_l(arg1: ::std::os::raw::c_int, arg2: locale_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn __tolower_l(__c: ::std::os::raw::c_int, __l: locale_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn tolower_l(__c: ::std::os::raw::c_int, __l: locale_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn __toupper_l(__c: ::std::os::raw::c_int, __l: locale_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn toupper_l(__c: ::std::os::raw::c_int, __l: locale_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn __assert_fail(
+ __assertion: *const ::std::os::raw::c_char,
+ __file: *const ::std::os::raw::c_char,
+ __line: ::std::os::raw::c_uint,
+ __function: *const ::std::os::raw::c_char,
+ ) -> !;
+}
+extern "C" {
+ pub fn __assert_perror_fail(
+ __errnum: ::std::os::raw::c_int,
+ __file: *const ::std::os::raw::c_char,
+ __line: ::std::os::raw::c_uint,
+ __function: *const ::std::os::raw::c_char,
+ ) -> !;
+}
+extern "C" {
+ pub fn __assert(
+ __assertion: *const ::std::os::raw::c_char,
+ __file: *const ::std::os::raw::c_char,
+ __line: ::std::os::raw::c_int,
+ ) -> !;
+}
+extern "C" {
+ pub fn memcpy(
+ __dest: *mut ::std::os::raw::c_void,
+ __src: *const ::std::os::raw::c_void,
+ __n: ::std::os::raw::c_ulong,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn memmove(
+ __dest: *mut ::std::os::raw::c_void,
+ __src: *const ::std::os::raw::c_void,
+ __n: ::std::os::raw::c_ulong,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn memccpy(
+ __dest: *mut ::std::os::raw::c_void,
+ __src: *const ::std::os::raw::c_void,
+ __c: ::std::os::raw::c_int,
+ __n: ::std::os::raw::c_ulong,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn memset(
+ __s: *mut ::std::os::raw::c_void,
+ __c: ::std::os::raw::c_int,
+ __n: ::std::os::raw::c_ulong,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn memcmp(
+ __s1: *const ::std::os::raw::c_void,
+ __s2: *const ::std::os::raw::c_void,
+ __n: ::std::os::raw::c_ulong,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn __memcmpeq(
+ __s1: *const ::std::os::raw::c_void,
+ __s2: *const ::std::os::raw::c_void,
+ __n: usize,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn memchr(
+ __s: *const ::std::os::raw::c_void,
+ __c: ::std::os::raw::c_int,
+ __n: ::std::os::raw::c_ulong,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn strcpy(
+ __dest: *mut ::std::os::raw::c_char,
+ __src: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn strncpy(
+ __dest: *mut ::std::os::raw::c_char,
+ __src: *const ::std::os::raw::c_char,
+ __n: ::std::os::raw::c_ulong,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn strcat(
+ __dest: *mut ::std::os::raw::c_char,
+ __src: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn strncat(
+ __dest: *mut ::std::os::raw::c_char,
+ __src: *const ::std::os::raw::c_char,
+ __n: ::std::os::raw::c_ulong,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn strcmp(
+ __s1: *const ::std::os::raw::c_char,
+ __s2: *const ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn strncmp(
+ __s1: *const ::std::os::raw::c_char,
+ __s2: *const ::std::os::raw::c_char,
+ __n: ::std::os::raw::c_ulong,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn strcoll(
+ __s1: *const ::std::os::raw::c_char,
+ __s2: *const ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn strxfrm(
+ __dest: *mut ::std::os::raw::c_char,
+ __src: *const ::std::os::raw::c_char,
+ __n: ::std::os::raw::c_ulong,
+ ) -> ::std::os::raw::c_ulong;
+}
+extern "C" {
+ pub fn strcoll_l(
+ __s1: *const ::std::os::raw::c_char,
+ __s2: *const ::std::os::raw::c_char,
+ __l: locale_t,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn strxfrm_l(
+ __dest: *mut ::std::os::raw::c_char,
+ __src: *const ::std::os::raw::c_char,
+ __n: usize,
+ __l: locale_t,
+ ) -> usize;
+}
+extern "C" {
+ pub fn strdup(__s: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn strndup(
+ __string: *const ::std::os::raw::c_char,
+ __n: ::std::os::raw::c_ulong,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn strchr(
+ __s: *const ::std::os::raw::c_char,
+ __c: ::std::os::raw::c_int,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn strrchr(
+ __s: *const ::std::os::raw::c_char,
+ __c: ::std::os::raw::c_int,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn strchrnul(
+ __s: *const ::std::os::raw::c_char,
+ __c: ::std::os::raw::c_int,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn strcspn(
+ __s: *const ::std::os::raw::c_char,
+ __reject: *const ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_ulong;
+}
+extern "C" {
+ pub fn strspn(
+ __s: *const ::std::os::raw::c_char,
+ __accept: *const ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_ulong;
+}
+extern "C" {
+ pub fn strpbrk(
+ __s: *const ::std::os::raw::c_char,
+ __accept: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn strstr(
+ __haystack: *const ::std::os::raw::c_char,
+ __needle: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn strtok(
+ __s: *mut ::std::os::raw::c_char,
+ __delim: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn __strtok_r(
+ __s: *mut ::std::os::raw::c_char,
+ __delim: *const ::std::os::raw::c_char,
+ __save_ptr: *mut *mut ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn strtok_r(
+ __s: *mut ::std::os::raw::c_char,
+ __delim: *const ::std::os::raw::c_char,
+ __save_ptr: *mut *mut ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn strcasestr(
+ __haystack: *const ::std::os::raw::c_char,
+ __needle: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn memmem(
+ __haystack: *const ::std::os::raw::c_void,
+ __haystacklen: usize,
+ __needle: *const ::std::os::raw::c_void,
+ __needlelen: usize,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn __mempcpy(
+ __dest: *mut ::std::os::raw::c_void,
+ __src: *const ::std::os::raw::c_void,
+ __n: usize,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn mempcpy(
+ __dest: *mut ::std::os::raw::c_void,
+ __src: *const ::std::os::raw::c_void,
+ __n: ::std::os::raw::c_ulong,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn strlen(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_ulong;
+}
+extern "C" {
+ pub fn strnlen(__string: *const ::std::os::raw::c_char, __maxlen: usize) -> usize;
+}
+extern "C" {
+ pub fn strerror(__errnum: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ #[link_name = "\u{1}__xpg_strerror_r"]
+ pub fn strerror_r(
+ __errnum: ::std::os::raw::c_int,
+ __buf: *mut ::std::os::raw::c_char,
+ __buflen: usize,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn strerror_l(
+ __errnum: ::std::os::raw::c_int,
+ __l: locale_t,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn bcmp(
+ __s1: *const ::std::os::raw::c_void,
+ __s2: *const ::std::os::raw::c_void,
+ __n: ::std::os::raw::c_ulong,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn bcopy(
+ __src: *const ::std::os::raw::c_void,
+ __dest: *mut ::std::os::raw::c_void,
+ __n: usize,
+ );
+}
+extern "C" {
+ pub fn bzero(__s: *mut ::std::os::raw::c_void, __n: ::std::os::raw::c_ulong);
+}
+extern "C" {
+ pub fn index(
+ __s: *const ::std::os::raw::c_char,
+ __c: ::std::os::raw::c_int,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn rindex(
+ __s: *const ::std::os::raw::c_char,
+ __c: ::std::os::raw::c_int,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn ffs(__i: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ffsl(__l: ::std::os::raw::c_long) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ffsll(__ll: ::std::os::raw::c_longlong) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn strcasecmp(
+ __s1: *const ::std::os::raw::c_char,
+ __s2: *const ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn strncasecmp(
+ __s1: *const ::std::os::raw::c_char,
+ __s2: *const ::std::os::raw::c_char,
+ __n: ::std::os::raw::c_ulong,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn strcasecmp_l(
+ __s1: *const ::std::os::raw::c_char,
+ __s2: *const ::std::os::raw::c_char,
+ __loc: locale_t,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn strncasecmp_l(
+ __s1: *const ::std::os::raw::c_char,
+ __s2: *const ::std::os::raw::c_char,
+ __n: usize,
+ __loc: locale_t,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn explicit_bzero(__s: *mut ::std::os::raw::c_void, __n: usize);
+}
+extern "C" {
+ pub fn strsep(
+ __stringp: *mut *mut ::std::os::raw::c_char,
+ __delim: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn strsignal(__sig: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn __stpcpy(
+ __dest: *mut ::std::os::raw::c_char,
+ __src: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn stpcpy(
+ __dest: *mut ::std::os::raw::c_char,
+ __src: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn __stpncpy(
+ __dest: *mut ::std::os::raw::c_char,
+ __src: *const ::std::os::raw::c_char,
+ __n: usize,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn stpncpy(
+ __dest: *mut ::std::os::raw::c_char,
+ __src: *const ::std::os::raw::c_char,
+ __n: ::std::os::raw::c_ulong,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn strlcpy(
+ __dest: *mut ::std::os::raw::c_char,
+ __src: *const ::std::os::raw::c_char,
+ __n: ::std::os::raw::c_ulong,
+ ) -> ::std::os::raw::c_ulong;
+}
+extern "C" {
+ pub fn strlcat(
+ __dest: *mut ::std::os::raw::c_char,
+ __src: *const ::std::os::raw::c_char,
+ __n: ::std::os::raw::c_ulong,
+ ) -> ::std::os::raw::c_ulong;
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct cursor {
+ pub start: *mut ::std::os::raw::c_uchar,
+ pub p: *mut ::std::os::raw::c_uchar,
+ pub end: *mut ::std::os::raw::c_uchar,
+}
+#[test]
+fn bindgen_test_layout_cursor() {
+ const UNINIT: ::std::mem::MaybeUninit<cursor> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<cursor>(),
+ 24usize,
+ concat!("Size of: ", stringify!(cursor))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<cursor>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(cursor))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).start) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(cursor),
+ "::",
+ stringify!(start)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).p) as usize - ptr as usize },
+ 8usize,
+ concat!("Offset of field: ", stringify!(cursor), "::", stringify!(p))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).end) as usize - ptr as usize },
+ 16usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(cursor),
+ "::",
+ stringify!(end)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct array {
+ pub cur: cursor,
+ pub elem_size: ::std::os::raw::c_uint,
+}
+#[test]
+fn bindgen_test_layout_array() {
+ const UNINIT: ::std::mem::MaybeUninit<array> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<array>(),
+ 32usize,
+ concat!("Size of: ", stringify!(array))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<array>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(array))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).cur) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(array),
+ "::",
+ stringify!(cur)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).elem_size) as usize - ptr as usize },
+ 24usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(array),
+ "::",
+ stringify!(elem_size)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_json_parser {
+ _unused: [u8; 0],
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb {
+ _unused: [u8; 0],
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_note {
+ _unused: [u8; 0],
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_tag {
+ _unused: [u8; 0],
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_tags {
+ _unused: [u8; 0],
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_lmdb {
+ _unused: [u8; 0],
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct ndb_packed_str {
+ _unused: [u8; 0],
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_t {
+ pub ndb: *mut ndb,
+}
+#[test]
+fn bindgen_test_layout_ndb_t() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_t> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_t>(),
+ 8usize,
+ concat!("Size of: ", stringify!(ndb_t))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_t>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_t))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).ndb) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_t),
+ "::",
+ stringify!(ndb)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct ndb_str {
+ pub flag: ::std::os::raw::c_uchar,
+ pub __bindgen_anon_1: ndb_str__bindgen_ty_1,
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub union ndb_str__bindgen_ty_1 {
+ pub str_: *const ::std::os::raw::c_char,
+ pub id: *mut ::std::os::raw::c_uchar,
+}
+#[test]
+fn bindgen_test_layout_ndb_str__bindgen_ty_1() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_str__bindgen_ty_1> =
+ ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_str__bindgen_ty_1>(),
+ 8usize,
+ concat!("Size of: ", stringify!(ndb_str__bindgen_ty_1))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_str__bindgen_ty_1>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_str__bindgen_ty_1))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).str_) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_str__bindgen_ty_1),
+ "::",
+ stringify!(str_)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_str__bindgen_ty_1),
+ "::",
+ stringify!(id)
+ )
+ );
+}
+#[test]
+fn bindgen_test_layout_ndb_str() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_str> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_str>(),
+ 16usize,
+ concat!("Size of: ", stringify!(ndb_str))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_str>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_str))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).flag) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_str),
+ "::",
+ stringify!(flag)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_keypair {
+ pub pubkey: [::std::os::raw::c_uchar; 32usize],
+ pub secret: [::std::os::raw::c_uchar; 32usize],
+ pub pair: [::std::os::raw::c_uchar; 96usize],
+}
+#[test]
+fn bindgen_test_layout_ndb_keypair() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_keypair> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_keypair>(),
+ 160usize,
+ concat!("Size of: ", stringify!(ndb_keypair))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_keypair>(),
+ 1usize,
+ concat!("Alignment of ", stringify!(ndb_keypair))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).pubkey) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_keypair),
+ "::",
+ stringify!(pubkey)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).secret) as usize - ptr as usize },
+ 32usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_keypair),
+ "::",
+ stringify!(secret)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).pair) as usize - ptr as usize },
+ 64usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_keypair),
+ "::",
+ stringify!(pair)
+ )
+ );
+}
+pub type ndb_idres = i32;
+pub type ndb_id_fn = ::std::option::Option<
+ unsafe extern "C" fn(
+ arg1: *mut ::std::os::raw::c_void,
+ arg2: *const ::std::os::raw::c_char,
+ ) -> ndb_idres,
+>;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_id_cb {
+ pub fn_: ndb_id_fn,
+ pub data: *mut ::std::os::raw::c_void,
+}
+#[test]
+fn bindgen_test_layout_ndb_id_cb() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_id_cb> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_id_cb>(),
+ 16usize,
+ concat!("Size of: ", stringify!(ndb_id_cb))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_id_cb>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_id_cb))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).fn_) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_id_cb),
+ "::",
+ stringify!(fn_)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
+ 8usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_id_cb),
+ "::",
+ stringify!(data)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_txn {
+ pub lmdb: *mut ndb_lmdb,
+ pub mdb_txn: *mut ::std::os::raw::c_void,
+}
+#[test]
+fn bindgen_test_layout_ndb_txn() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_txn> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_txn>(),
+ 16usize,
+ concat!("Size of: ", stringify!(ndb_txn))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_txn>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_txn))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).lmdb) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_txn),
+ "::",
+ stringify!(lmdb)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).mdb_txn) as usize - ptr as usize },
+ 8usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_txn),
+ "::",
+ stringify!(mdb_txn)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_event {
+ pub note: *mut ndb_note,
+}
+#[test]
+fn bindgen_test_layout_ndb_event() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_event> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_event>(),
+ 8usize,
+ concat!("Size of: ", stringify!(ndb_event))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_event>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_event))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).note) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_event),
+ "::",
+ stringify!(note)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_command_result {
+ pub ok: ::std::os::raw::c_int,
+ pub msg: *const ::std::os::raw::c_char,
+ pub msglen: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_ndb_command_result() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_command_result> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_command_result>(),
+ 24usize,
+ concat!("Size of: ", stringify!(ndb_command_result))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_command_result>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_command_result))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).ok) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_command_result),
+ "::",
+ stringify!(ok)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).msg) as usize - ptr as usize },
+ 8usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_command_result),
+ "::",
+ stringify!(msg)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).msglen) as usize - ptr as usize },
+ 16usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_command_result),
+ "::",
+ stringify!(msglen)
+ )
+ );
+}
+pub const fce_type_NDB_FCE_EVENT: fce_type = 1;
+pub type fce_type = ::std::os::raw::c_uint;
+pub const tce_type_NDB_TCE_EVENT: tce_type = 1;
+pub const tce_type_NDB_TCE_OK: tce_type = 2;
+pub const tce_type_NDB_TCE_NOTICE: tce_type = 3;
+pub const tce_type_NDB_TCE_EOSE: tce_type = 4;
+pub type tce_type = ::std::os::raw::c_uint;
+pub const ndb_ingest_filter_action_NDB_INGEST_REJECT: ndb_ingest_filter_action = 0;
+pub const ndb_ingest_filter_action_NDB_INGEST_ACCEPT: ndb_ingest_filter_action = 1;
+pub const ndb_ingest_filter_action_NDB_INGEST_SKIP_VALIDATION: ndb_ingest_filter_action = 2;
+pub type ndb_ingest_filter_action = ::std::os::raw::c_uint;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_search_key {
+ pub search: [::std::os::raw::c_char; 24usize],
+ pub id: [::std::os::raw::c_uchar; 32usize],
+ pub timestamp: u64,
+}
+#[test]
+fn bindgen_test_layout_ndb_search_key() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_search_key> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_search_key>(),
+ 64usize,
+ concat!("Size of: ", stringify!(ndb_search_key))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_search_key>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_search_key))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).search) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_search_key),
+ "::",
+ stringify!(search)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize },
+ 24usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_search_key),
+ "::",
+ stringify!(id)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).timestamp) as usize - ptr as usize },
+ 56usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_search_key),
+ "::",
+ stringify!(timestamp)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_search {
+ pub key: *mut ndb_search_key,
+ pub profile_key: u64,
+ pub cursor: *mut ::std::os::raw::c_void,
+}
+#[test]
+fn bindgen_test_layout_ndb_search() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_search> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_search>(),
+ 24usize,
+ concat!("Size of: ", stringify!(ndb_search))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_search>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_search))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_search),
+ "::",
+ stringify!(key)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).profile_key) as usize - ptr as usize },
+ 8usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_search),
+ "::",
+ stringify!(profile_key)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).cursor) as usize - ptr as usize },
+ 16usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_search),
+ "::",
+ stringify!(cursor)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct ndb_fce {
+ pub evtype: fce_type,
+ pub __bindgen_anon_1: ndb_fce__bindgen_ty_1,
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub union ndb_fce__bindgen_ty_1 {
+ pub event: ndb_event,
+}
+#[test]
+fn bindgen_test_layout_ndb_fce__bindgen_ty_1() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_fce__bindgen_ty_1> =
+ ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_fce__bindgen_ty_1>(),
+ 8usize,
+ concat!("Size of: ", stringify!(ndb_fce__bindgen_ty_1))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_fce__bindgen_ty_1>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_fce__bindgen_ty_1))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).event) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_fce__bindgen_ty_1),
+ "::",
+ stringify!(event)
+ )
+ );
+}
+#[test]
+fn bindgen_test_layout_ndb_fce() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_fce> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_fce>(),
+ 16usize,
+ concat!("Size of: ", stringify!(ndb_fce))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_fce>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_fce))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).evtype) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_fce),
+ "::",
+ stringify!(evtype)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct ndb_tce {
+ pub evtype: tce_type,
+ pub subid: *const ::std::os::raw::c_char,
+ pub subid_len: ::std::os::raw::c_int,
+ pub __bindgen_anon_1: ndb_tce__bindgen_ty_1,
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub union ndb_tce__bindgen_ty_1 {
+ pub event: ndb_event,
+ pub command_result: ndb_command_result,
+}
+#[test]
+fn bindgen_test_layout_ndb_tce__bindgen_ty_1() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_tce__bindgen_ty_1> =
+ ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_tce__bindgen_ty_1>(),
+ 24usize,
+ concat!("Size of: ", stringify!(ndb_tce__bindgen_ty_1))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_tce__bindgen_ty_1>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_tce__bindgen_ty_1))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).event) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_tce__bindgen_ty_1),
+ "::",
+ stringify!(event)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).command_result) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_tce__bindgen_ty_1),
+ "::",
+ stringify!(command_result)
+ )
+ );
+}
+#[test]
+fn bindgen_test_layout_ndb_tce() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_tce> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_tce>(),
+ 48usize,
+ concat!("Size of: ", stringify!(ndb_tce))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_tce>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_tce))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).evtype) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_tce),
+ "::",
+ stringify!(evtype)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).subid) as usize - ptr as usize },
+ 8usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_tce),
+ "::",
+ stringify!(subid)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).subid_len) as usize - ptr as usize },
+ 16usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_tce),
+ "::",
+ stringify!(subid_len)
+ )
+ );
+}
+pub type ndb_ingest_filter_fn = ::std::option::Option<
+ unsafe extern "C" fn(
+ arg1: *mut ::std::os::raw::c_void,
+ arg2: *mut ndb_note,
+ ) -> ndb_ingest_filter_action,
+>;
+pub const ndb_filter_fieldtype_NDB_FILTER_IDS: ndb_filter_fieldtype = 1;
+pub const ndb_filter_fieldtype_NDB_FILTER_AUTHORS: ndb_filter_fieldtype = 2;
+pub const ndb_filter_fieldtype_NDB_FILTER_KINDS: ndb_filter_fieldtype = 3;
+pub const ndb_filter_fieldtype_NDB_FILTER_GENERIC: ndb_filter_fieldtype = 4;
+pub const ndb_filter_fieldtype_NDB_FILTER_SINCE: ndb_filter_fieldtype = 5;
+pub const ndb_filter_fieldtype_NDB_FILTER_UNTIL: ndb_filter_fieldtype = 6;
+pub const ndb_filter_fieldtype_NDB_FILTER_LIMIT: ndb_filter_fieldtype = 7;
+pub type ndb_filter_fieldtype = ::std::os::raw::c_uint;
+pub const ndb_generic_element_type_NDB_ELEMENT_UNKNOWN: ndb_generic_element_type = 0;
+pub const ndb_generic_element_type_NDB_ELEMENT_STRING: ndb_generic_element_type = 1;
+pub const ndb_generic_element_type_NDB_ELEMENT_ID: ndb_generic_element_type = 2;
+pub type ndb_generic_element_type = ::std::os::raw::c_uint;
+pub const ndb_search_order_NDB_ORDER_DESCENDING: ndb_search_order = 0;
+pub const ndb_search_order_NDB_ORDER_ASCENDING: ndb_search_order = 1;
+pub type ndb_search_order = ::std::os::raw::c_uint;
+pub const ndb_dbs_NDB_DB_NOTE: ndb_dbs = 0;
+pub const ndb_dbs_NDB_DB_META: ndb_dbs = 1;
+pub const ndb_dbs_NDB_DB_PROFILE: ndb_dbs = 2;
+pub const ndb_dbs_NDB_DB_NOTE_ID: ndb_dbs = 3;
+pub const ndb_dbs_NDB_DB_PROFILE_PK: ndb_dbs = 4;
+pub const ndb_dbs_NDB_DB_NDB_META: ndb_dbs = 5;
+pub const ndb_dbs_NDB_DB_PROFILE_SEARCH: ndb_dbs = 6;
+pub const ndb_dbs_NDB_DB_PROFILE_LAST_FETCH: ndb_dbs = 7;
+pub const ndb_dbs_NDB_DB_NOTE_KIND: ndb_dbs = 8;
+pub const ndb_dbs_NDB_DB_NOTE_TEXT: ndb_dbs = 9;
+pub const ndb_dbs_NDB_DBS: ndb_dbs = 10;
+pub type ndb_dbs = ::std::os::raw::c_uint;
+pub const ndb_common_kind_NDB_CKIND_PROFILE: ndb_common_kind = 0;
+pub const ndb_common_kind_NDB_CKIND_TEXT: ndb_common_kind = 1;
+pub const ndb_common_kind_NDB_CKIND_CONTACTS: ndb_common_kind = 2;
+pub const ndb_common_kind_NDB_CKIND_DM: ndb_common_kind = 3;
+pub const ndb_common_kind_NDB_CKIND_DELETE: ndb_common_kind = 4;
+pub const ndb_common_kind_NDB_CKIND_REPOST: ndb_common_kind = 5;
+pub const ndb_common_kind_NDB_CKIND_REACTION: ndb_common_kind = 6;
+pub const ndb_common_kind_NDB_CKIND_ZAP: ndb_common_kind = 7;
+pub const ndb_common_kind_NDB_CKIND_ZAP_REQUEST: ndb_common_kind = 8;
+pub const ndb_common_kind_NDB_CKIND_NWC_REQUEST: ndb_common_kind = 9;
+pub const ndb_common_kind_NDB_CKIND_NWC_RESPONSE: ndb_common_kind = 10;
+pub const ndb_common_kind_NDB_CKIND_HTTP_AUTH: ndb_common_kind = 11;
+pub const ndb_common_kind_NDB_CKIND_LIST: ndb_common_kind = 12;
+pub const ndb_common_kind_NDB_CKIND_LONGFORM: ndb_common_kind = 13;
+pub const ndb_common_kind_NDB_CKIND_STATUS: ndb_common_kind = 14;
+pub const ndb_common_kind_NDB_CKIND_COUNT: ndb_common_kind = 15;
+pub type ndb_common_kind = ::std::os::raw::c_uint;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_builder {
+ pub mem: cursor,
+ pub note_cur: cursor,
+ pub strings: cursor,
+ pub str_indices: cursor,
+ pub note: *mut ndb_note,
+ pub current_tag: *mut ndb_tag,
+}
+#[test]
+fn bindgen_test_layout_ndb_builder() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_builder> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_builder>(),
+ 112usize,
+ concat!("Size of: ", stringify!(ndb_builder))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_builder>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_builder))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).mem) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_builder),
+ "::",
+ stringify!(mem)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).note_cur) as usize - ptr as usize },
+ 24usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_builder),
+ "::",
+ stringify!(note_cur)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).strings) as usize - ptr as usize },
+ 48usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_builder),
+ "::",
+ stringify!(strings)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).str_indices) as usize - ptr as usize },
+ 72usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_builder),
+ "::",
+ stringify!(str_indices)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).note) as usize - ptr as usize },
+ 96usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_builder),
+ "::",
+ stringify!(note)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).current_tag) as usize - ptr as usize },
+ 104usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_builder),
+ "::",
+ stringify!(current_tag)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_iterator {
+ pub note: *mut ndb_note,
+ pub tag: *mut ndb_tag,
+ pub index: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_ndb_iterator() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_iterator> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_iterator>(),
+ 24usize,
+ concat!("Size of: ", stringify!(ndb_iterator))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_iterator>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_iterator))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).note) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_iterator),
+ "::",
+ stringify!(note)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).tag) as usize - ptr as usize },
+ 8usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_iterator),
+ "::",
+ stringify!(tag)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).index) as usize - ptr as usize },
+ 16usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_iterator),
+ "::",
+ stringify!(index)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub union ndb_filter_element {
+ pub string: *const ::std::os::raw::c_char,
+ pub id: *const ::std::os::raw::c_uchar,
+ pub integer: u64,
+}
+#[test]
+fn bindgen_test_layout_ndb_filter_element() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_filter_element> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_filter_element>(),
+ 8usize,
+ concat!("Size of: ", stringify!(ndb_filter_element))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_filter_element>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_filter_element))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).string) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_filter_element),
+ "::",
+ stringify!(string)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_filter_element),
+ "::",
+ stringify!(id)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).integer) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_filter_element),
+ "::",
+ stringify!(integer)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_filter_field {
+ pub type_: ndb_filter_fieldtype,
+ pub elem_type: ndb_generic_element_type,
+ pub generic: ::std::os::raw::c_char,
+}
+#[test]
+fn bindgen_test_layout_ndb_filter_field() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_filter_field> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_filter_field>(),
+ 12usize,
+ concat!("Size of: ", stringify!(ndb_filter_field))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_filter_field>(),
+ 4usize,
+ concat!("Alignment of ", stringify!(ndb_filter_field))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_filter_field),
+ "::",
+ stringify!(type_)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).elem_type) as usize - ptr as usize },
+ 4usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_filter_field),
+ "::",
+ stringify!(elem_type)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).generic) as usize - ptr as usize },
+ 8usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_filter_field),
+ "::",
+ stringify!(generic)
+ )
+ );
+}
+#[repr(C)]
+pub struct ndb_filter_elements {
+ pub field: ndb_filter_field,
+ pub count: ::std::os::raw::c_int,
+ pub elements: __IncompleteArrayField<ndb_filter_element>,
+}
+#[test]
+fn bindgen_test_layout_ndb_filter_elements() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_filter_elements> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_filter_elements>(),
+ 16usize,
+ concat!("Size of: ", stringify!(ndb_filter_elements))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_filter_elements>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_filter_elements))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).field) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_filter_elements),
+ "::",
+ stringify!(field)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).count) as usize - ptr as usize },
+ 12usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_filter_elements),
+ "::",
+ stringify!(count)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).elements) as usize - ptr as usize },
+ 16usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_filter_elements),
+ "::",
+ stringify!(elements)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_filter {
+ pub elem_buf: cursor,
+ pub data_buf: cursor,
+ pub num_elements: ::std::os::raw::c_int,
+ pub current: *mut ndb_filter_elements,
+ pub elements: [*mut ndb_filter_elements; 7usize],
+}
+#[test]
+fn bindgen_test_layout_ndb_filter() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_filter> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_filter>(),
+ 120usize,
+ concat!("Size of: ", stringify!(ndb_filter))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_filter>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_filter))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).elem_buf) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_filter),
+ "::",
+ stringify!(elem_buf)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).data_buf) as usize - ptr as usize },
+ 24usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_filter),
+ "::",
+ stringify!(data_buf)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).num_elements) as usize - ptr as usize },
+ 48usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_filter),
+ "::",
+ stringify!(num_elements)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).current) as usize - ptr as usize },
+ 56usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_filter),
+ "::",
+ stringify!(current)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).elements) as usize - ptr as usize },
+ 64usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_filter),
+ "::",
+ stringify!(elements)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_config {
+ pub flags: ::std::os::raw::c_int,
+ pub ingester_threads: ::std::os::raw::c_int,
+ pub mapsize: usize,
+ pub filter_context: *mut ::std::os::raw::c_void,
+ pub ingest_filter: ndb_ingest_filter_fn,
+}
+#[test]
+fn bindgen_test_layout_ndb_config() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_config> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_config>(),
+ 32usize,
+ concat!("Size of: ", stringify!(ndb_config))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_config>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_config))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_config),
+ "::",
+ stringify!(flags)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).ingester_threads) as usize - ptr as usize },
+ 4usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_config),
+ "::",
+ stringify!(ingester_threads)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).mapsize) as usize - ptr as usize },
+ 8usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_config),
+ "::",
+ stringify!(mapsize)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).filter_context) as usize - ptr as usize },
+ 16usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_config),
+ "::",
+ stringify!(filter_context)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).ingest_filter) as usize - ptr as usize },
+ 24usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_config),
+ "::",
+ stringify!(ingest_filter)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_text_search_config {
+ pub order: ndb_search_order,
+ pub limit: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_ndb_text_search_config() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_text_search_config> =
+ ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_text_search_config>(),
+ 8usize,
+ concat!("Size of: ", stringify!(ndb_text_search_config))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_text_search_config>(),
+ 4usize,
+ concat!("Alignment of ", stringify!(ndb_text_search_config))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).order) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_text_search_config),
+ "::",
+ stringify!(order)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).limit) as usize - ptr as usize },
+ 4usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_text_search_config),
+ "::",
+ stringify!(limit)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_stat_counts {
+ pub key_size: usize,
+ pub value_size: usize,
+ pub count: usize,
+}
+#[test]
+fn bindgen_test_layout_ndb_stat_counts() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_stat_counts> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_stat_counts>(),
+ 24usize,
+ concat!("Size of: ", stringify!(ndb_stat_counts))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_stat_counts>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_stat_counts))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).key_size) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_stat_counts),
+ "::",
+ stringify!(key_size)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).value_size) as usize - ptr as usize },
+ 8usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_stat_counts),
+ "::",
+ stringify!(value_size)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).count) as usize - ptr as usize },
+ 16usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_stat_counts),
+ "::",
+ stringify!(count)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_stat {
+ pub dbs: [ndb_stat_counts; 10usize],
+ pub common_kinds: [ndb_stat_counts; 15usize],
+ pub other_kinds: ndb_stat_counts,
+}
+#[test]
+fn bindgen_test_layout_ndb_stat() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_stat> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_stat>(),
+ 624usize,
+ concat!("Size of: ", stringify!(ndb_stat))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_stat>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_stat))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).dbs) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_stat),
+ "::",
+ stringify!(dbs)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).common_kinds) as usize - ptr as usize },
+ 240usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_stat),
+ "::",
+ stringify!(common_kinds)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).other_kinds) as usize - ptr as usize },
+ 600usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_stat),
+ "::",
+ stringify!(other_kinds)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_text_search_key {
+ pub str_len: ::std::os::raw::c_int,
+ pub str_: *const ::std::os::raw::c_char,
+ pub timestamp: u64,
+ pub note_id: u64,
+ pub word_index: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_ndb_text_search_key() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_text_search_key> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_text_search_key>(),
+ 40usize,
+ concat!("Size of: ", stringify!(ndb_text_search_key))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_text_search_key>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_text_search_key))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).str_len) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_text_search_key),
+ "::",
+ stringify!(str_len)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).str_) as usize - ptr as usize },
+ 8usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_text_search_key),
+ "::",
+ stringify!(str_)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).timestamp) as usize - ptr as usize },
+ 16usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_text_search_key),
+ "::",
+ stringify!(timestamp)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).note_id) as usize - ptr as usize },
+ 24usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_text_search_key),
+ "::",
+ stringify!(note_id)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).word_index) as usize - ptr as usize },
+ 32usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_text_search_key),
+ "::",
+ stringify!(word_index)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_text_search_result {
+ pub key: ndb_text_search_key,
+ pub prefix_chars: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_ndb_text_search_result() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_text_search_result> =
+ ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_text_search_result>(),
+ 48usize,
+ concat!("Size of: ", stringify!(ndb_text_search_result))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_text_search_result>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_text_search_result))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_text_search_result),
+ "::",
+ stringify!(key)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).prefix_chars) as usize - ptr as usize },
+ 40usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_text_search_result),
+ "::",
+ stringify!(prefix_chars)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct ndb_text_search_results {
+ pub results: [ndb_text_search_result; 128usize],
+ pub num_results: ::std::os::raw::c_int,
+}
+#[test]
+fn bindgen_test_layout_ndb_text_search_results() {
+ const UNINIT: ::std::mem::MaybeUninit<ndb_text_search_results> =
+ ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<ndb_text_search_results>(),
+ 6152usize,
+ concat!("Size of: ", stringify!(ndb_text_search_results))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<ndb_text_search_results>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(ndb_text_search_results))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).results) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_text_search_results),
+ "::",
+ stringify!(results)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).num_results) as usize - ptr as usize },
+ 6144usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(ndb_text_search_results),
+ "::",
+ stringify!(num_results)
+ )
+ );
+}
+extern "C" {
+ pub fn ndb_default_config(arg1: *mut ndb_config);
+}
+extern "C" {
+ pub fn ndb_config_set_ingest_threads(config: *mut ndb_config, threads: ::std::os::raw::c_int);
+}
+extern "C" {
+ pub fn ndb_config_set_flags(config: *mut ndb_config, flags: ::std::os::raw::c_int);
+}
+extern "C" {
+ pub fn ndb_config_set_mapsize(config: *mut ndb_config, mapsize: usize);
+}
+extern "C" {
+ pub fn ndb_config_set_ingest_filter(
+ config: *mut ndb_config,
+ fn_: ndb_ingest_filter_fn,
+ arg1: *mut ::std::os::raw::c_void,
+ );
+}
+extern "C" {
+ pub fn ndb_calculate_id(
+ note: *mut ndb_note,
+ buf: *mut ::std::os::raw::c_uchar,
+ buflen: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_sign_id(
+ keypair: *mut ndb_keypair,
+ id: *mut ::std::os::raw::c_uchar,
+ sig: *mut ::std::os::raw::c_uchar,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_create_keypair(key: *mut ndb_keypair) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_decode_key(
+ secstr: *const ::std::os::raw::c_char,
+ keypair: *mut ndb_keypair,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_note_verify(
+ secp_ctx: *mut ::std::os::raw::c_void,
+ pubkey: *mut ::std::os::raw::c_uchar,
+ id: *mut ::std::os::raw::c_uchar,
+ signature: *mut ::std::os::raw::c_uchar,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_init(
+ ndb: *mut *mut ndb,
+ dbdir: *const ::std::os::raw::c_char,
+ arg1: *const ndb_config,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_db_version(ndb: *mut ndb) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_process_event(
+ arg1: *mut ndb,
+ json: *const ::std::os::raw::c_char,
+ len: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_process_events(
+ arg1: *mut ndb,
+ ldjson: *const ::std::os::raw::c_char,
+ len: usize,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_process_events_stream(arg1: *mut ndb, fp: *mut FILE) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_process_client_event(
+ arg1: *mut ndb,
+ json: *const ::std::os::raw::c_char,
+ len: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_process_client_events(
+ arg1: *mut ndb,
+ json: *const ::std::os::raw::c_char,
+ len: usize,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_begin_query(arg1: *mut ndb, arg2: *mut ndb_txn) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_search_profile(
+ txn: *mut ndb_txn,
+ search: *mut ndb_search,
+ query: *const ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_search_profile_next(search: *mut ndb_search) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_search_profile_end(search: *mut ndb_search);
+}
+extern "C" {
+ pub fn ndb_end_query(arg1: *mut ndb_txn) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_write_last_profile_fetch(
+ ndb: *mut ndb,
+ pubkey: *const ::std::os::raw::c_uchar,
+ fetched_at: u64,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_read_last_profile_fetch(
+ txn: *mut ndb_txn,
+ pubkey: *const ::std::os::raw::c_uchar,
+ ) -> u64;
+}
+extern "C" {
+ pub fn ndb_get_profile_by_pubkey(
+ txn: *mut ndb_txn,
+ pubkey: *const ::std::os::raw::c_uchar,
+ len: *mut usize,
+ primkey: *mut u64,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn ndb_get_profile_by_key(
+ txn: *mut ndb_txn,
+ key: u64,
+ len: *mut usize,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn ndb_get_notekey_by_id(txn: *mut ndb_txn, id: *const ::std::os::raw::c_uchar) -> u64;
+}
+extern "C" {
+ pub fn ndb_get_profilekey_by_pubkey(
+ txn: *mut ndb_txn,
+ id: *const ::std::os::raw::c_uchar,
+ ) -> u64;
+}
+extern "C" {
+ pub fn ndb_get_note_by_id(
+ txn: *mut ndb_txn,
+ id: *const ::std::os::raw::c_uchar,
+ len: *mut usize,
+ primkey: *mut u64,
+ ) -> *mut ndb_note;
+}
+extern "C" {
+ pub fn ndb_get_note_by_key(txn: *mut ndb_txn, key: u64, len: *mut usize) -> *mut ndb_note;
+}
+extern "C" {
+ pub fn ndb_get_note_meta(
+ txn: *mut ndb_txn,
+ id: *const ::std::os::raw::c_uchar,
+ len: *mut usize,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn ndb_destroy(arg1: *mut ndb);
+}
+extern "C" {
+ pub fn ndb_parse_json_note(
+ arg1: *mut ndb_json_parser,
+ arg2: *mut *mut ndb_note,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_client_event_from_json(
+ json: *const ::std::os::raw::c_char,
+ len: ::std::os::raw::c_int,
+ fce: *mut ndb_fce,
+ buf: *mut ::std::os::raw::c_uchar,
+ bufsize: ::std::os::raw::c_int,
+ cb: *mut ndb_id_cb,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_ws_event_from_json(
+ json: *const ::std::os::raw::c_char,
+ len: ::std::os::raw::c_int,
+ tce: *mut ndb_tce,
+ buf: *mut ::std::os::raw::c_uchar,
+ bufsize: ::std::os::raw::c_int,
+ arg1: *mut ndb_id_cb,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_note_from_json(
+ json: *const ::std::os::raw::c_char,
+ len: ::std::os::raw::c_int,
+ arg1: *mut *mut ndb_note,
+ buf: *mut ::std::os::raw::c_uchar,
+ buflen: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_builder_init(
+ builder: *mut ndb_builder,
+ buf: *mut ::std::os::raw::c_uchar,
+ bufsize: usize,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_builder_finalize(
+ builder: *mut ndb_builder,
+ note: *mut *mut ndb_note,
+ privkey: *mut ndb_keypair,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_builder_set_content(
+ builder: *mut ndb_builder,
+ content: *const ::std::os::raw::c_char,
+ len: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_builder_set_created_at(builder: *mut ndb_builder, created_at: u64);
+}
+extern "C" {
+ pub fn ndb_builder_set_sig(builder: *mut ndb_builder, sig: *mut ::std::os::raw::c_uchar);
+}
+extern "C" {
+ pub fn ndb_builder_set_pubkey(builder: *mut ndb_builder, pubkey: *mut ::std::os::raw::c_uchar);
+}
+extern "C" {
+ pub fn ndb_builder_set_id(builder: *mut ndb_builder, id: *mut ::std::os::raw::c_uchar);
+}
+extern "C" {
+ pub fn ndb_builder_set_kind(builder: *mut ndb_builder, kind: u32);
+}
+extern "C" {
+ pub fn ndb_builder_new_tag(builder: *mut ndb_builder) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_builder_push_tag_str(
+ builder: *mut ndb_builder,
+ str_: *const ::std::os::raw::c_char,
+ len: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_filter_init(arg1: *mut ndb_filter) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_filter_add_id_element(
+ arg1: *mut ndb_filter,
+ id: *const ::std::os::raw::c_uchar,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_filter_add_int_element(arg1: *mut ndb_filter, integer: u64)
+ -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_filter_add_str_element(
+ arg1: *mut ndb_filter,
+ str_: *const ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_filter_start_field(
+ arg1: *mut ndb_filter,
+ arg2: ndb_filter_fieldtype,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_filter_start_generic_field(
+ arg1: *mut ndb_filter,
+ tag: ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_filter_matches(arg1: *mut ndb_filter, arg2: *mut ndb_note) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_filter_reset(arg1: *mut ndb_filter);
+}
+extern "C" {
+ pub fn ndb_filter_end_field(arg1: *mut ndb_filter);
+}
+extern "C" {
+ pub fn ndb_filter_free(arg1: *mut ndb_filter);
+}
+extern "C" {
+ pub fn ndb_text_search(
+ txn: *mut ndb_txn,
+ query: *const ::std::os::raw::c_char,
+ arg1: *mut ndb_text_search_results,
+ arg2: *mut ndb_text_search_config,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_default_text_search_config(arg1: *mut ndb_text_search_config);
+}
+extern "C" {
+ pub fn ndb_text_search_config_set_order(
+ arg1: *mut ndb_text_search_config,
+ arg2: ndb_search_order,
+ );
+}
+extern "C" {
+ pub fn ndb_text_search_config_set_limit(
+ arg1: *mut ndb_text_search_config,
+ limit: ::std::os::raw::c_int,
+ );
+}
+extern "C" {
+ pub fn ndb_stat(ndb: *mut ndb, stat: *mut ndb_stat) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_stat_counts_init(counts: *mut ndb_stat_counts);
+}
+extern "C" {
+ pub fn ndb_note_content(note: *mut ndb_note) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn ndb_note_str(note: *mut ndb_note, pstr: *mut ndb_packed_str) -> ndb_str;
+}
+extern "C" {
+ pub fn ndb_note_content_length(note: *mut ndb_note) -> u32;
+}
+extern "C" {
+ pub fn ndb_note_created_at(note: *mut ndb_note) -> u32;
+}
+extern "C" {
+ pub fn ndb_note_kind(note: *mut ndb_note) -> u32;
+}
+extern "C" {
+ pub fn ndb_note_id(note: *mut ndb_note) -> *mut ::std::os::raw::c_uchar;
+}
+extern "C" {
+ pub fn ndb_note_pubkey(note: *mut ndb_note) -> *mut ::std::os::raw::c_uchar;
+}
+extern "C" {
+ pub fn ndb_note_sig(note: *mut ndb_note) -> *mut ::std::os::raw::c_uchar;
+}
+extern "C" {
+ pub fn _ndb_note_set_kind(note: *mut ndb_note, kind: u32);
+}
+extern "C" {
+ pub fn ndb_note_tags(note: *mut ndb_note) -> *mut ndb_tags;
+}
+extern "C" {
+ pub fn ndb_tags_iterate_start(note: *mut ndb_note, iter: *mut ndb_iterator);
+}
+extern "C" {
+ pub fn ndb_tags_count(arg1: *mut ndb_tags) -> u16;
+}
+extern "C" {
+ pub fn ndb_tag_count(arg1: *mut ndb_tag) -> u16;
+}
+extern "C" {
+ pub fn ndb_tags_iterate_next(iter: *mut ndb_iterator) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ndb_iter_tag_str(iter: *mut ndb_iterator, ind: ::std::os::raw::c_int) -> ndb_str;
+}
+extern "C" {
+ pub fn ndb_tag_str(
+ note: *mut ndb_note,
+ tag: *mut ndb_tag,
+ ind: ::std::os::raw::c_int,
+ ) -> ndb_str;
+}
+extern "C" {
+ pub fn ndb_db_name(db: ndb_dbs) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn ndb_kind_name(ck: ndb_common_kind) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn ndb_kind_to_common_kind(kind: ::std::os::raw::c_int) -> ndb_common_kind;
+}
+pub type __builtin_va_list = [__va_list_tag; 1usize];
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct __va_list_tag {
+ pub gp_offset: ::std::os::raw::c_uint,
+ pub fp_offset: ::std::os::raw::c_uint,
+ pub overflow_arg_area: *mut ::std::os::raw::c_void,
+ pub reg_save_area: *mut ::std::os::raw::c_void,
+}
+#[test]
+fn bindgen_test_layout___va_list_tag() {
+ const UNINIT: ::std::mem::MaybeUninit<__va_list_tag> = ::std::mem::MaybeUninit::uninit();
+ let ptr = UNINIT.as_ptr();
+ assert_eq!(
+ ::std::mem::size_of::<__va_list_tag>(),
+ 24usize,
+ concat!("Size of: ", stringify!(__va_list_tag))
+ );
+ assert_eq!(
+ ::std::mem::align_of::<__va_list_tag>(),
+ 8usize,
+ concat!("Alignment of ", stringify!(__va_list_tag))
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).gp_offset) as usize - ptr as usize },
+ 0usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(__va_list_tag),
+ "::",
+ stringify!(gp_offset)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).fp_offset) as usize - ptr as usize },
+ 4usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(__va_list_tag),
+ "::",
+ stringify!(fp_offset)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).overflow_arg_area) as usize - ptr as usize },
+ 8usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(__va_list_tag),
+ "::",
+ stringify!(overflow_arg_area)
+ )
+ );
+ assert_eq!(
+ unsafe { ::std::ptr::addr_of!((*ptr).reg_save_area) as usize - ptr as usize },
+ 16usize,
+ concat!(
+ "Offset of field: ",
+ stringify!(__va_list_tag),
+ "::",
+ stringify!(reg_save_area)
+ )
+ );
+}
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct __locale_data {
+ pub _address: u8,
+}
diff --git a/src/config.rs b/src/config.rs
@@ -0,0 +1,43 @@
+use crate::bindings;
+
+// The Rust wrapper for ndb_config
+pub struct NdbConfig {
+ pub config: bindings::ndb_config,
+}
+
+impl NdbConfig {
+ // Constructor
+ pub fn new() -> Self {
+ let mut config = bindings::ndb_config {
+ filter_context: std::ptr::null_mut(),
+ ingest_filter: None,
+ flags: 0,
+ ingester_threads: 0,
+ mapsize: 0,
+ };
+
+ unsafe {
+ bindings::ndb_default_config(&mut config);
+ }
+
+ NdbConfig { config }
+ }
+
+ // Example setter methods
+ pub fn set_flags(&mut self, flags: i32) -> &mut Self {
+ self.config.flags = flags;
+ self
+ }
+
+ pub fn set_ingester_threads(&mut self, threads: i32) -> &mut Self {
+ self.config.ingester_threads = threads;
+ self
+ }
+
+ // Add other setter methods as needed
+
+ // Internal method to get a raw pointer to the config, used in Ndb
+ pub fn as_ptr(&self) -> *const bindings::ndb_config {
+ &self.config
+ }
+}
diff --git a/src/error.rs b/src/error.rs
@@ -0,0 +1,3 @@
+pub enum Error {
+ DbOpenFailed,
+}
diff --git a/src/lib.rs b/src/lib.rs
@@ -0,0 +1,10 @@
+#[allow(non_upper_case_globals)]
+#[allow(non_camel_case_types)]
+#[allow(non_snake_case)]
+#[allow(unused)]
+mod bindings;
+
+mod config;
+mod error;
+mod ndb;
+mod result;
diff --git a/src/ndb.rs b/src/ndb.rs
@@ -0,0 +1,61 @@
+use std::ffi::CString;
+use std::ptr;
+
+use crate::bindings;
+use crate::config::NdbConfig;
+use crate::error::Error;
+use crate::result::Result;
+
+pub struct Ndb {
+ ndb: *mut bindings::ndb,
+}
+
+impl Ndb {
+ // Constructor
+ pub fn new(db_dir: &str, config: &NdbConfig) -> Result<Self> {
+ let db_dir_cstr = match CString::new(db_dir) {
+ Ok(cstr) => cstr,
+ Err(_) => return Err(Error::DbOpenFailed),
+ };
+ let mut ndb: *mut bindings::ndb = ptr::null_mut();
+ let result = unsafe { bindings::ndb_init(&mut ndb, db_dir_cstr.as_ptr(), config.as_ptr()) };
+
+ if result != 0 {
+ return Err(Error::DbOpenFailed);
+ }
+
+ Ok(Ndb { ndb })
+ }
+
+ // Add other methods to interact with the library here
+}
+
+impl Drop for Ndb {
+ fn drop(&mut self) {
+ unsafe {
+ bindings::ndb_destroy(self.ndb);
+ }
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use std::fs;
+
+ fn cleanup() {
+ let _ = fs::remove_file("data.mdb");
+ let _ = fs::remove_file("lock.mdb");
+ }
+
+ #[test]
+ fn ndb_init_works() {
+ // Initialize ndb
+ {
+ let cfg = NdbConfig::new();
+ let _ = Ndb::new(".", &cfg);
+ }
+
+ cleanup();
+ }
+}
diff --git a/src/result.rs b/src/result.rs
@@ -0,0 +1,3 @@
+use crate::error::Error;
+
+pub type Result<T> = std::result::Result<T, Error>;