Hasty Briefsbeta

Bilingual

CO3: Toward the Optimal FFI

2 days ago
  • CO3 is a Rust FFI framework designed for optimal bidirectional interfacing with the C ABI, emphasizing minimalism, zero-cost abstractions, and soundness.
  • It allows using native Rust types directly in FFI, including generics, through static monomorphization or runtime tag-dispatched parameters.
  • The framework enforces soundness by default, with opt-in conversion modes for ownership transfer and soft conversions, ensuring robust C-compatible representations.
  • CO3 solves precursor problems with crates like `disjoint_impls` (for non-overlapping impls) and `rust-spec` (for type categorization), enabling safe and ergonomic FFI.
  • It supports polymorphism via runtime-tagged dispatch and static parameter interpolation, with compile-time checking of dispatch tags.
  • The library is production-ready, tested, and demonstrated in real-world projects like rs-odbc, but needs wider adoption and integration with C header generators.
  • The developer reflects on personal sacrifices, AI's rapid advancement, and the imminence of technological singularity, while expressing gratitude to supporters.