From: Martin Pitt Date: Fri, 27 Aug 2021 06:43:12 +0000 (+0200) Subject: Initial libmount function call from Rust X-Git-Url: https://piware.de/gitweb/?p=learn-rust.git;a=commitdiff_plain;h=08dccd05a79d2cf2bdd4b6cd8ccaa8baa02b0a54;hp=08dccd05a79d2cf2bdd4b6cd8ccaa8baa02b0a54 Initial libmount function call from Rust Follow "A little C with your Rust" [1]. Set up cargo and main.rs skeleton and call one of the simplest possible functions from libmount: mnt_get_fstab_path(). Use bindgen [1] to translate libmount's header file into a Rust interface. This requires a few hacks: - bindgen does not accept the original header right away, as it can't find stdarg.h. Avoid this by dropping the (unnecessary) stdio.h include. - bindgen does not know about `size_t`. Hack around that with a typedef for now. - Suppress warnings about constant/identifier naming. [1] https://rust-lang.github.io/rust-bindgen/command-line-usage.html [2] https://docs.rust-embedded.org/book/interoperability/c-with-rust.html ---