Add Rust code to the build
Just to get the build going with some Rust code in it:
-
Update the CI a bit -
Include my script from gnome-shell to call cargo from meson. -
From the C code, call a ipuz_noop()
implemented in Rust. -
Generate the ipuz-rust.h
header instead of writing it by hand. -
Discuss how to call C code from Rust - use bindgen, or write prototypes individually as we need them? -
Fix the CI -
Change the code coverage job so it works with a mixed C+Rust code base.
C header file from the Rust code
I plan to use cbindgen; it works really well. For this initial build, I'm just using a hand-written ipuz-rust.h
file. The idea is to generate that completely with cbindgen.
Calling C code from the Rust code
Writing C function prototypes on the Rust side is... not hard? It's what we did in librsvg since we were adding them piecemeal, as we needed them.
For large-scale automated C-to-Rust stuff, there is bindgen. It may help with translating data structures. I haven't used it personally; it generates a lot of code and fancy tests, but it works.
Edited by Federico Mena Quintero