]> git.ipfire.org Git - thirdparty/qemu.git/commit
rust: qemu_api: introduce MaybeUninit field projection
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 28 Feb 2025 08:41:42 +0000 (09:41 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 17 Jun 2025 07:54:51 +0000 (09:54 +0200)
commitabf18324240a3c8f3feafbe5a96d4b83cd044615
treec0826a7ba0472230df0f00986a40b4d759595932
parent6c2888dd0f9b7129943d53cacd6a7b7143a65cfb
rust: qemu_api: introduce MaybeUninit field projection

Add a macro that makes it possible to convert a MaybeUninit<> into
another MaybeUninit<> for a single field within it.  Furthermore, it is
possible to use the resulting MaybeUninitField<> in APIs that take the
parent object, such as memory_region_init_io().

This allows removing some of the undefined behavior from instance_init()
functions, though this may not be the definitive implementation.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
rust/qemu-api/meson.build
rust/qemu-api/src/lib.rs
rust/qemu-api/src/uninit.rs [new file with mode: 0644]