transcribe-cpp-sys 0.0.4

Native FFI bindings for transcribe.cpp, a C/C++ speech-to-text library built on ggml
Documentation
//! Raw native FFI bindings for [transcribe.cpp](https://github.com/handy-computer/transcribe.cpp),
//! a C/C++ speech-to-text library built on ggml.
//!
//! This crate is the unsafe, generated FFI surface. The safe, idiomatic API is
//! the [`transcribe-cpp`](https://crates.io/crates/transcribe-cpp) crate.
//!
//! The bindings in [`transcribe_sys`] are generated by `bindings/rust/xtask`
//! (bindgen, comments disabled for determinism) from
//! `include/transcribe/extensions.h` — the flattened public surface
//! (`transcribe.h` plus every family extension header) — and committed to the
//! repo, so building this crate needs no libclang. CI regenerates them and
//! diffs against the committed copy, pinned to `include/transcribe.abihash`
//! (`xtask check`); per-field ABI layout checks are waived because bindgen
//! takes layout from a real compiler (see the crate README).

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(dead_code)]

#[allow(clippy::all)]
mod transcribe_sys {
    include!("transcribe_sys.rs");
}

pub use transcribe_sys::*;

#[cfg(test)]
mod smoke {
    //! Proves the whole chain wires up: the cmake source build, the link
    //! manifest -> link line, and the committed bindgen surface. If this links
    //! and prints a version, `build.rs` and the FFI are sound.
    use super::*;
    use std::ffi::CStr;

    #[test]
    fn version_links_and_matches_package() {
        let raw = unsafe { transcribe_version() };
        assert!(!raw.is_null());
        let version = unsafe { CStr::from_ptr(raw) }.to_str().unwrap();
        assert_eq!(version, env!("CARGO_PKG_VERSION"));
    }

    #[test]
    fn abi_struct_size_is_live() {
        // A real call into the native lib that returns a runtime value.
        let size =
            unsafe { transcribe_abi_struct_size(transcribe_abi_struct::TRANSCRIBE_ABI_RUN_PARAMS) };
        assert!(size > 0);
    }
}