aboutsummaryrefslogtreecommitdiff
path: root/rust/qemu-api/src/bindings.rs
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-11-12 11:52:23 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2024-12-10 18:44:06 +0100
commitcb7ada5409f171dae364f206a7fe3ff30fcba7cb (patch)
tree5fc025795b5e9db9902ff0b1590b768f937c241b /rust/qemu-api/src/bindings.rs
parent8c2866750319fac3f7b641d1a097f3779952631d (diff)
downloadqemu-cb7ada5409f171dae364f206a7fe3ff30fcba7cb.zip
qemu-cb7ada5409f171dae364f206a7fe3ff30fcba7cb.tar.gz
qemu-cb7ada5409f171dae364f206a7fe3ff30fcba7cb.tar.bz2
rust: allow using build-root bindings.rs from cargo
Right now, using cargo with QEMU requires copying by hand the bindings.rs to the source tree. Instead, we can use an include file to escape the cage of cargo's mandated source directory structure. By running cargo within meson's "devenv" and adding a MESON_BUILD_ROOT environment variable, it is easy for build.rs to find the file. However, the file must be symlinked into cargo's output directory for rust-analyzer to find it. Suggested-by: Junjie Mao <junjie.mao@hotmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'rust/qemu-api/src/bindings.rs')
-rw-r--r--rust/qemu-api/src/bindings.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/rust/qemu-api/src/bindings.rs b/rust/qemu-api/src/bindings.rs
new file mode 100644
index 0000000..0b76ec5
--- /dev/null
+++ b/rust/qemu-api/src/bindings.rs
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+#![allow(
+ dead_code,
+ improper_ctypes_definitions,
+ improper_ctypes,
+ non_camel_case_types,
+ non_snake_case,
+ non_upper_case_globals,
+ unsafe_op_in_unsafe_fn,
+ clippy::missing_const_for_fn,
+ clippy::too_many_arguments,
+ clippy::approx_constant,
+ clippy::use_self,
+ clippy::useless_transmute,
+ clippy::missing_safety_doc
+)]
+
+#[cfg(MESON)]
+include!("bindings.inc.rs");
+
+#[cfg(not(MESON))]
+include!(concat!(env!("OUT_DIR"), "/bindings.inc.rs"));
+
+unsafe impl Send for Property {}
+unsafe impl Sync for Property {}
+unsafe impl Sync for TypeInfo {}
+unsafe impl Sync for VMStateDescription {}
+unsafe impl Sync for VMStateField {}
+unsafe impl Sync for VMStateInfo {}