Skip to main content

astrid_sys/
lib.rs

1//! Component Model bindings for the Astrid OS System API (The Airlocks).
2//!
3//! This crate generates typed guest bindings from the `astrid-capsule.wit`
4//! interface using `wit-bindgen`. It provides:
5//!
6//! - **Host import functions** — typed calls to the kernel (fs, ipc, kv, etc.)
7//! - **Guest export trait** — `Guest` trait that capsules implement
8//! - **`export!` macro** — wires a `Guest` implementation as component exports
9//! - **WIT types** — generated Rust structs for all WIT records
10//!
11//! Capsule authors typically use `astrid-sdk` (the ergonomic wrapper) rather
12//! than this crate directly. The `#[capsule]` proc macro generates the
13//! `impl Guest` and `export!()` call automatically.
14
15#![deny(clippy::all)]
16#![deny(unreachable_pub)]
17
18// wit-bindgen generates code with patterns that trip clippy (e.g. Vec::from_raw_parts
19// with same length and capacity). Suppress only for the generated module.
20#[allow(clippy::all, clippy::pedantic, unreachable_pub, unsafe_code)]
21mod generated {
22    wit_bindgen::generate!({
23        world: "capsule",
24        path: "wit",
25        pub_export_macro: true,
26        generate_unused_types: true,
27        additional_derives: [
28            serde::Serialize,
29            serde::Deserialize,
30            PartialEq,
31        ],
32    });
33}
34
35pub use generated::*;