# cbindgen configuration for snapdir-ffi
# Generates include/snapdir.h (C99, never hand-edited).
# Run: cbindgen --config crates/snapdir-ffi/cbindgen.toml --crate snapdir-ffi -o include/snapdir.h

language = "C"

# Header include guard (emits #ifndef SNAPDIR_H / #define SNAPDIR_H / #endif)
include_guard = "SNAPDIR_H"

# Doc-comment style: c99 emits // single-line comments (compatible with C99 compilers)
documentation_style = "c99"

# Autogenerated warning banner (no timestamp → diff-stable across regenerations).
autogen_warning = "/* Generated by cbindgen. DO NOT EDIT. */"

# Suppress cbindgen's hardcoded default block (stdarg.h / stdbool.h / stdint.h / stdlib.h).
# We emit exactly the C99 headers required for this surface via sys_includes below.
no_includes = true

# Emit exactly the headers the ABI surface needs, in a stable order:
#   stdint.h  — uint32_t (for SNAPDIR_ABI_VERSION / future integer types)
#   stdbool.h — bool (for future bool parameters in later gate symbols)
sys_includes = ["stdint.h", "stdbool.h"]

[export]
# Explicitly include the opaque type and the ABI version constant so cbindgen
# always emits them regardless of visibility heuristics.
include = ["SnapdirError", "SNAPDIR_ABI_VERSION"]

# Exclude internal / pub(crate) helpers that must not appear in the public header.
exclude = [
    "catch_entry",
    "catch_entry_unwind_safe",
    "cstr_to_str",
    "ffi_write_api_error",
]

[struct]
# Do not emit derived impls (no constructor/eq in C).
derive_constructor = false
derive_eq = false

[fn]
# Sort all exported functions alphabetically for deterministic output across
# Rust toolchain bumps (declaration order can shift; Name sort is stable).
sort_by = "Name"

[const]
# Render `pub const SNAPDIR_ABI_VERSION: u32 = 1;` as `#define SNAPDIR_ABI_VERSION 1`.
allow_static_const = true
allow_constexpr = false

[parse]
parse_deps = false
