libcqdb 0.4.0

C binding to the Rust implementation of Constant Quark Database (CQDB)
Documentation
// Taken from https://github.com/hyperium/hyper/blob/master/src/ffi/macros.rs
macro_rules! ffi_fn {
    ($(#[$doc:meta])* fn $name:ident($($arg:ident: $arg_ty:ty),*) -> $ret:ty $body:block) => {
        $(#[$doc])*
        #[unsafe(no_mangle)]
        #[allow(clippy::not_unsafe_ptr_arg_deref)]
        pub extern "C" fn $name($($arg: $arg_ty),*) -> $ret {
            use std::panic::{self, AssertUnwindSafe};

            match panic::catch_unwind(AssertUnwindSafe(move || $body)) {
                Ok(v) => v,
                Err(_) => {
                    // TODO: We shouldn't abort, but rather figure out how to
                    // convert into the return type that the function errored.
                    eprintln!("panic unwind caught, aborting");
                    std::process::abort();
                }
            }
        }
    };

    ($(#[$doc:meta])* fn $name:ident($($arg:ident: $arg_ty:ty),*) $body:block) => {
        ffi_fn!($(#[$doc])* fn $name($($arg: $arg_ty),*) -> () $body);
    };
}