qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 15/26] rust: qom: split ObjectType from ObjectImpl trait


From: Zhao Liu
Subject: Re: [PATCH 15/26] rust: qom: split ObjectType from ObjectImpl trait
Date: Wed, 11 Dec 2024 16:41:28 +0800

On Mon, Dec 09, 2024 at 01:37:06PM +0100, Paolo Bonzini wrote:
> Date: Mon,  9 Dec 2024 13:37:06 +0100
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH 15/26] rust: qom: split ObjectType from ObjectImpl trait
> X-Mailer: git-send-email 2.47.1
> 
> Define a separate trait for fields that also applies to classes that are
> defined by C code.  This makes it possible to add metadata to core classes,
> which has multiple uses:
> 
> - it makes it possible to access the parent struct's TYPE_* for types
>   that are defined in Rust code, and to avoid repeating it in every subclass
> 
> - implementors of ObjectType will be allowed to implement the IsA<> trait and
>   therefore to perform typesafe casts from one class to another.
> 
> - in the future, an ObjectType could be created with Foo::new() in a type-safe
>   manner, without having to pass a TYPE_* constant.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  rust/hw/char/pl011/src/device.rs  | 17 ++++++++++++-----
>  rust/qemu-api/src/definitions.rs  |  9 ++++++---
>  rust/qemu-api/src/device_class.rs | 11 ++++++-----
>  rust/qemu-api/src/prelude.rs      |  2 ++
>  rust/qemu-api/src/sysbus.rs       | 10 ++++++++--
>  rust/qemu-api/tests/tests.rs      | 12 +++++++++---
>  6 files changed, 43 insertions(+), 18 deletions(-)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]