rgpot_core/c_api/mod.rs
1// MIT License
2// Copyright 2023--present rgpot developers
3
4//! Public C API entry points.
5//!
6//! Each submodule exposes `extern "C"` functions that cbindgen collects into
7//! `rgpot-core/include/rgpot.h`. All functions in this module follow three
8//! invariants:
9//!
10//! 1. **Return [`rgpot_status_t`](crate::status::rgpot_status_t)** (or a
11//! pointer / void for constructors and destructors).
12//! 2. **Wrap the body in [`catch_unwind`](crate::status::catch_unwind)** to
13//! prevent panics from crossing the FFI boundary.
14//! 3. **Validate pointer arguments** and call
15//! [`set_last_error`](crate::status::set_last_error) before returning a
16//! non-success status.
17//!
18//! ## Submodules
19//!
20//! - [`types`] — Convenience constructors for
21//! [`rgpot_force_input_t`](crate::types::rgpot_force_input_t) and
22//! [`rgpot_force_out_t`](crate::types::rgpot_force_out_t).
23//! - [`potential`] — Lifecycle functions for
24//! [`rgpot_potential_t`](crate::potential::rgpot_potential_t): create,
25//! calculate, free.
26//! - [`rpc`] — RPC client functions (feature-gated on `rpc`): connect,
27//! calculate, disconnect.
28
29pub mod types;
30pub mod potential;
31
32#[cfg(feature = "rpc")]
33pub mod rpc;