gen_rust_utilities

Generate Rust FFI bindings for selected Basilisk C ABI utilities.

The generated bindings intentionally cover only C ABI headers. C++/Eigen APIs need a dedicated C shim and are excluded until that interface is designed.

Install the exact command-line generator version before regenerating the committed bindings:

cargo install bindgen-cli --version '=0.72.1' --locked

The script rejects missing or mismatched versions rather than producing tool-version-dependent changes to bsk_utilities/src/raw.rs.

The script accepts two include-root layouts:

  • Basilisk core (default here): --bsk-include points at (or defaults to) this repo’s own src/ – headers are included bare, e.g. architecture/utilities/astroConstants.h.

  • Vendored headers: an include root with a Basilisk/ subdirectory. Headers are included as Basilisk/architecture/utilities/astroConstants.h. This layout is detected when <include-root>/Basilisk exists.

gen_rust_utilities.find_bindgen() str[source]

Return the pinned bindgen executable or stop with installation help.

gen_rust_utilities.find_default_include_root() Path[source]

Default to this repo’s own src/ (Basilisk core layout).

gen_rust_utilities.main() None[source]

Generate bsk_utilities/src/raw.rs.

gen_rust_utilities.resolve_layout(include_root: Path) tuple[Path, str][source]

Return (basilisk_include_dir, header_prefix) for this include root.

A vendored root has a Basilisk/ subdirectory containing the actual headers, with the root itself on the include path so #include "Basilisk/architecture/..." resolves; Basilisk core’s own src/ is that directory already, with nothing to prefix.

gen_rust_utilities.run_bindgen(wrapper_path: Path, include_root: Path, basilisk_dir: Path) str[source]

Run bindgen over the selected C ABI headers.

include_root resolves the wrapper header’s own #include lines (written with header_prefix); basilisk_dir resolves the internal cross-includes Basilisk headers use among themselves, which are always bare (e.g. "architecture/utilities/linearAlgebra.h") regardless of header_prefix. The two are the same directory in Basilisk core’s own layout (no prefix) and different directories for a vendored root (see resolve_layout).