Skip to main content

xpile_ffi_manifest/
lib.rs

1//! FFI boundary registry.
2//!
3//! In a hybrid transpile (e.g. Python + C extension, Python + CUDA
4//! kernel), the agent must know exactly which symbols cross language
5//! lines and what their Rust shim signatures should be. This crate is
6//! the single source of truth for that mapping within a session.
7
8use serde::{Deserialize, Serialize};
9use xpile_meta_hir::SourceLang;
10
11#[derive(Debug, Clone, Default, Serialize, Deserialize)]
12pub struct FfiManifest {
13    pub entries: Vec<FfiEntry>,
14}
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct FfiEntry {
18    pub symbol: String,
19    pub from_lang: SourceLang,
20    pub to_lang: SourceLang,
21    pub source_signature: String,
22    pub rust_shim_signature: String,
23    pub shim_id: String,
24}
25
26impl FfiManifest {
27    pub fn new() -> Self {
28        Self::default()
29    }
30
31    pub fn register(&mut self, entry: FfiEntry) {
32        self.entries.push(entry);
33    }
34}