On Mon, Jun 26, 2023 at 08:02:08AM +0000, Tage Johansson wrote:
From: Tage Johansson <frans.tage@gmail.com>
This commit creates basic Rust bindings in the rust directory. The bindings are generated by generator/Rust.ml and generator/Rust.mli.
No tests are created so far.
In rust/libnbd-sys, [rust-bindgen](https://github.com/rust-lang/rust-bindgen) is used to generate low level Rust bindings to libnbd.h. This requires Clang, see [this link](https://rust-lang.github.io/rust-bindgen/requirements.html#clang). Ultimately, we shall generate the low level bindings without rust-bindgen in the future so that Clang would not be required.
Apart from Clang, you would need Cargo with Rustdoc and Rustfmt to build the Rust bindings. See [here](https://www.rust-lang.org/tools/install) for installation instructions. --- Makefile.am | 1 + configure.ac | 28 ++ generator/Makefile.am | 2 + generator/Rust.ml | 529 +++++++++++++++++++++++++++++++++++++ generator/Rust.mli | 20 ++ generator/generator.ml | 2 + generator/utils.ml | 9 +- generator/utils.mli | 3 +- rust/.gitignore | 3 + rust/Cargo.toml | 48 ++++ rust/Makefile.am | 60 +++++ rust/cargo_test/.gitignore | 2 +
Do we need the separate .gitignore files? I tend to prefer everything in the top-level .gitignore (just one file to edit when amending the list of ignored files, instead of a recursive hunt for which .gitignore is most applicable). Also, have a look at scripts/git.orderfile; it includes a trick for making your diffs display in an order more logical for reviewers than just alphabetical by filename. I haven't reviewed the patch itself at this time (I'm letting Rich have first crack at it). -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org