tinyquant-sys 0.0.0

C ABI façade for TinyQuant (cdylib + staticlib).
#
# cbindgen configuration for tinyquant-sys.
#
# The generated header `include/tinyquant.h` is committed source, not a
# build artifact. `build.rs` regenerates it on every `cargo build -p
# tinyquant-sys`, and CI fails on any non-empty diff — forcing the Rust
# author to commit header changes alongside the implementation.
#
# See docs/plans/rust/phase-22-pyo3-cabi-release.md §cbindgen drift guard.
#
language       = "C"
pragma_once    = false
include_guard  = "TINYQUANT_H"
cpp_compat     = true
include_version = true
tab_width      = 4
documentation  = true
documentation_style = "doxy"
style          = "type"
sort_by        = "Name"

# Emit a version macro identical to CARGO_PKG_VERSION so C consumers can
# assert header / library parity at preprocessor time.
header = """
/*
 * tinyquant.h — generated by cbindgen from tinyquant-sys.
 *
 * DO NOT EDIT BY HAND. Regenerate with:
 *   cargo build -p tinyquant-sys
 *
 * CI gate: `git diff --exit-code rust/crates/tinyquant-sys/include/tinyquant.h`.
 */
#define TINYQUANT_H_VERSION "@version@"
"""

autogen_warning = "/* WARNING: regenerate this file via `cargo build -p tinyquant-sys`. */"

[parse]
parse_deps = false

[export]
# `tq_test_panic` is a test-only symbol behind `cfg(any(test,
# feature = "panic-probe"))`. It should not appear in the header of a
# normal release build.
exclude = ["tq_test_panic", "tinyquant_version"]

[export.rename]
"TinyQuantErrorKind" = "TinyQuantErrorKind"
"TinyQuantError"     = "TinyQuantError"
"TinyQuantCompressionPolicy" = "TinyQuantCompressionPolicy"

[enum]
# Emit enum variants with their type name as prefix (e.g.
# `TINY_QUANT_ERROR_KIND_OK`). Bare `OK` / `PANIC` would collide with
# frequent C macros in consumer code.
prefix_with_name = true
rename_variants  = "ScreamingSnakeCase"