~/talk

Generating ergonomic C++ APIs using Rustdoc, procedural macros, and Serde

Talkat RustLab 2024 · 2024-11-09..11-11· [rust, api-design]
slides:none on file

Generates idiomatic C++ bindings by turning annotated Rust functions into low‑level extern "C" byte‑buffer stubs, using procedural macros to emit pointer-safe FFI and unwind-safe error handling, then parsing Rustdoc JSON plus rustdoc-types to discover APIs and running Serde/bincode for (de)serialization; produces generated C and C++ headers and high‑level wrappers. Framework shipped as Buffy and Buffy‑macro on crates.io, runs in production and customer deployments for over a year, trades modest serialization overhead for zero manual unsafe glue and safer cross‑language ergonomics, requires nightly rustdoc JSON pinning.

AI-written summary · about

  1. 0:00Rust FFI journey
  2. 1:51Need for better FFI solutions
  3. 3:35Manual FFI problems
  4. 6:05Goals for ergonomic APIs
  5. 7:31Extern C with macros
  6. 11:27Rustdoc for code analysis
  7. 13:58Filtering functions and types
  8. 15:22C++ code from Rust types
  9. 16:51Simple C++ API example
  10. 18:14Async and cyclic types example
  11. 19:40Approach pros and cons
  12. 21:28Introducing Buffy macro
  13. 22:29Production readiness
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.