Skip to main content

Crate kglite_c

Crate kglite_c 

Source
Expand description

§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.
  • statusKgliteStatusCode enum + KgErrorCode mapping.
  • strings — owned-out-string allocation + kglite_free_string.
  • graphKgliteGraph opaque handle + load/save/free.
  • sessionKgliteSession opaque handle + execute_read / execute_mut.
  • resultKgliteCypherResult opaque handle + JSON accessors.

Each submodule’s items are re-exported at the crate root so the generated kglite.h is a flat namespace.

Re-exports§

pub use abi::*;
pub use embedder::*;
pub use graph::*;
pub use result::*;
pub use session::*;
pub use status::*;
pub use strings::*;

Modules§

abi
ABI version probe — bindings call kglite_abi_version on startup and fail loudly if the runtime ABI’s major version doesn’t match what they were compiled against.
datasets
Dataset C ABI — synchronous wrappers over kglite’s blocking fetchers. One submodule per dataset; each gated behind its matching Cargo feature so consumers can opt into only the loaders they need.
embedder
KgliteEmbedder opaque handle + concrete-impl factories.
graph
KgliteGraph opaque handle — load_file, save_graph, free.
result
KgliteCypherResult opaque handle + JSON accessors.
session
KgliteSession opaque handle — session creation + execute_read / execute_mut.
status
Status-code surface: KgliteStatusCode enum + 1:1 mapping to kglite::api::KgErrorCode + the three canonical accessors (name, neo4j_status, http_status).
strings
Owned-out-string allocation. Every C-ABI function that hands a string back to the caller goes through [alloc_c_string] (which returns a *const c_char the caller MUST free via kglite_free_string).