1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! # kglite-c — C ABI for the kglite knowledge graph engine.
//!
//! Non-Rust bindings (Go via cgo, JavaScript via napi, JVM via JNI,
//! .NET via P/Invoke, …) consume a single C header
//! (`include/kglite.h`) rather than re-implementing wrappers in
//! their host language. This crate is glue — the engine itself
//! lives in `kglite`, and `kglite-c` exposes a curated subset via
//! `#[no_mangle] extern "C"` functions.
//!
//! See `docs/rust/c-abi.md` in the kglite repo for the design
//! conventions (naming, ownership, error pattern, JSON-at-boundary
//! choices) and `crates/kglite-c/README.md` for the user-facing
//! quickstart.
//!
//! ## Module structure
//!
//! - [`abi`] — ABI version probe + status code helpers.
//! - [`status`] — `KgliteStatusCode` enum + `KgErrorCode` mapping.
//! - [`strings`] — owned-out-string allocation + `kglite_free_string`.
//! - [`graph`] — `KgliteGraph` opaque handle + load/save/free.
//! - [`session`] — `KgliteSession` opaque handle + execute_read /
//! execute_mut.
//! - [`result`] — `KgliteCypherResult` opaque handle + JSON accessors.
//!
//! Each submodule's items are re-exported at the crate root so the
//! generated `kglite.h` is a flat namespace.
// SAFETY docs live in the module-level comments + per-function doc
// comments. cbindgen reads the function-level doc comments into the
// generated header so each C function's doc is self-contained.
// extern "C" functions are by definition unsafe at the C ABI
// boundary; the unsafe-ness is the caller's responsibility, not
// ours to wrap up in `unsafe { ... }` for clippy's sake.
// Re-export every C-ABI item at the crate root. cbindgen picks
// items up from any module reachable via this crate, but the
// flat structure here keeps the generated header tidy and easier
// for binding authors to navigate.
pub use *;
// Datasets — each loader sits behind its own feature; re-exported
// at the crate root so cbindgen picks the C functions up at the
// flat namespace level.
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;