On Mon, Oct 21, 2024 at 06:35:37PM +0200, Paolo Bonzini wrote:
> Date: Mon, 21 Oct 2024 18:35:37 +0200
> From: Paolo Bonzini <pbonz...@redhat.com>
> Subject: [PATCH v2 12/13] rust: provide safe wrapper for
>  MaybeUninit::zeroed()
> X-Mailer: git-send-email 2.46.2
> 
> MaybeUninit::zeroed() is handy, but it introduces unsafe (and has a
> pretty heavy syntax in general).  Introduce a trait that provides the
> same functionality while staying within safe Rust.
> 
> In addition, MaybeUninit::zeroed() is not available as a "const"
> function until Rust 1.75.0, so this also prepares for having handwritten
> implementations of the trait until we can assume that version.
> 
> Reviewed-by: Junjie Mao <junjie....@hotmail.com>
> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
> ---
>  rust/hw/char/pl011/src/device_class.rs |  8 ++++++--
>  rust/hw/char/pl011/src/memory_ops.rs   | 11 +++++++----
>  rust/qemu-api/meson.build              |  1 +
>  rust/qemu-api/src/device_class.rs      |  8 ++++----
>  rust/qemu-api/src/lib.rs               |  1 +
>  rust/qemu-api/src/zeroable.rs          | 23 +++++++++++++++++++++++
>  6 files changed, 42 insertions(+), 10 deletions(-)
>  create mode 100644 rust/qemu-api/src/zeroable.rs

Reviewed-by: Zhao Liu <zhao1....@intel.com>


Reply via email to