qemu/rust/qemu-api
Paolo Bonzini fff99a88be rust: assertions: Support index field wrapped in BqlCell
Currently, if the `num` field of a varray is not a numeric type, such as
being placed in a wrapper, the array variant of assert_field_type will
fail the check.

HPET currently wraps num_timers in BqlCell<>. Although BqlCell<> is not
necessary from strictly speaking, it makes sense for vmstate to respect
BqlCell.

The failure of assert_field_type is because it cannot convert BqlCell<T>
into usize for use as the index.  Use a constant 0 instead for the index,
by avoiding $(...)? and extracting the common parts of
assert_field_type! into an internal case.

Commit message based on a patch by Zhao Liu <zhao1.liu@intel.com>.

Link: https://lore.kernel.org/r/20250414144943.1112885-3-zhao1.liu@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-05-02 17:37:46 +02:00
..
src rust: assertions: Support index field wrapped in BqlCell 2025-05-02 17:37:46 +02:00
tests rust/vmstate_test: Fix typo in test_vmstate_macro_array_of_pointer_wrapped() 2025-04-23 10:35:23 +02:00
.gitignore rust: allow using build-root bindings.rs from cargo 2024-12-10 18:44:06 +01:00
build.rs rust: build: add "make clippy", "make rustfmt", "make rustdoc" 2024-12-10 18:44:06 +01:00
Cargo.toml rust: subprojects: add libc crate 2025-02-25 10:49:23 +01:00
meson.build rust/vmstate: Add unit test for vmstate_of macro 2025-03-21 12:56:00 +01:00
README.md rust: build: add "make clippy", "make rustfmt", "make rustdoc" 2024-12-10 18:44:06 +01:00

QEMU bindings and API wrappers

This library exports helper Rust types, Rust macros and C FFI bindings for internal QEMU APIs.

The C bindings can be generated with bindgen, using this build target:

$ make bindings.inc.rs

Generate Rust documentation

Common Cargo tasks can be performed from the QEMU build directory

$ make clippy
$ make rustfmt
$ make rustdoc