rust: add a utility module for compile-time type checks

It is relatively common in the low-level qemu_api code to assert that
a field of a struct has a specific type; for example, it can be used
to ensure that the fields match what the qemu_api and C code expects
for safety.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2024-12-11 12:18:06 +01:00
parent ca0d60a6ad
commit 7f65d4e58b
3 changed files with 92 additions and 0 deletions

View file

@ -15,6 +15,7 @@ _qemu_api_rs = static_library(
structured_sources(
[
'src/lib.rs',
'src/assertions.rs',
'src/bindings.rs',
'src/bitops.rs',
'src/callbacks.rs',