[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 16/26] rust: qom: change the parent type to an associated typ
From: |
Zhao Liu |
Subject: |
Re: [PATCH 16/26] rust: qom: change the parent type to an associated type |
Date: |
Wed, 11 Dec 2024 16:47:36 +0800 |
On Mon, Dec 09, 2024 at 01:37:07PM +0100, Paolo Bonzini wrote:
> Date: Mon, 9 Dec 2024 13:37:07 +0100
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH 16/26] rust: qom: change the parent type to an associated
> type
> X-Mailer: git-send-email 2.47.1
>
> Avoid duplicated code to retrieve the QOM type strings from the
> Rust type.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> rust/hw/char/pl011/src/device.rs | 6 ++++--
> rust/qemu-api/src/definitions.rs | 8 ++------
> rust/qemu-api/tests/tests.rs | 3 +--
> 3 files changed, 7 insertions(+), 10 deletions(-)
>
...
> @@ -76,11 +76,7 @@ pub trait ObjectImpl: ObjectType + ClassInitImpl {
>
> const TYPE_INFO: TypeInfo = TypeInfo {
> name: Self::TYPE_NAME.as_ptr(),
> - parent: if let Some(pname) = Self::PARENT_TYPE_NAME {
> - pname.as_ptr()
> - } else {
> - core::ptr::null_mut()
> - },
> + parent: Self::ParentType::TYPE_NAME.as_ptr(),
Object is implemented at C side, so at leaset the ParentType should be
TYPE_OBJECT.
> instance_size: core::mem::size_of::<Self>(),
> instance_align: core::mem::align_of::<Self>(),
> instance_init: match Self::INSTANCE_INIT {
Great!
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
- Re: [PATCH 14/26] rust: qom: move bridge for TypeInfo functions out of pl011, (continued)
Re: [PATCH 14/26] rust: qom: move bridge for TypeInfo functions out of pl011, Zhao Liu, 2024/12/10
[PATCH 15/26] rust: qom: split ObjectType from ObjectImpl trait, Paolo Bonzini, 2024/12/09
[PATCH 11/26] rust: qdev: move device_class_init! body to generic function, ClassInitImpl implementation to macro, Paolo Bonzini, 2024/12/09
[PATCH 16/26] rust: qom: change the parent type to an associated type, Paolo Bonzini, 2024/12/09
- Re: [PATCH 16/26] rust: qom: change the parent type to an associated type,
Zhao Liu <=
[PATCH 19/26] rust: rename qemu-api modules to follow C code a bit more, Paolo Bonzini, 2024/12/09
[PATCH 24/26] rust: qom: move device_id to PL011 class side, Paolo Bonzini, 2024/12/09