Skip to main content

bux_sys/
lib.rs

1//! Raw FFI bindings to [`libkrun`] — a lightweight VM engine for sandboxed execution.
2//!
3//! All types and functions are **auto-generated** by [`bindgen`](https://docs.rs/bindgen)
4//! from the [`libkrun.h`] header. Do not edit `bindings.rs` manually.
5//!
6//! # Build
7//!
8//! The build script (`build.rs`) automatically:
9//! 1. Downloads the pre-built dynamic library from GitHub Releases
10//!    (or uses a local path via `BUX_DEPS_DIR`).
11//! 2. Configures the linker for dynamic linking.
12//!
13//! For local development, set `BUX_DEPS_DIR` to point at a directory
14//! containing the pre-built `libkrun` dynamic library.
15//!
16//! [`libkrun`]: https://github.com/containers/libkrun
17//! [`libkrun.h`]: https://github.com/qntx/libkrun/blob/main/include/libkrun.h
18
19// sys crate: unsafe FFI, non-idiomatic generated code
20#![allow(
21    unsafe_code,
22    missing_docs,
23    non_camel_case_types,
24    non_upper_case_globals,
25    non_snake_case,
26    clippy::missing_safety_doc,
27    clippy::upper_case_acronyms
28)]
29
30// When the `regenerate` feature is enabled, use freshly generated bindings.
31// Otherwise, use the pre-generated bindings committed in the repository.
32#[cfg(feature = "regenerate")]
33include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
34#[cfg(not(feature = "regenerate"))]
35include!("bindings.rs");