[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 10/26] rust: qom: move ClassInitImpl to the instance side, (continued)
- [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 17/26] rust: qom: put class_init together from multiple ClassInitImpl<>, Paolo Bonzini, 2024/12/09
- [PATCH 20/26] rust: re-export C types from qemu-api submodules, Paolo Bonzini, 2024/12/09
- [PATCH 14/26] rust: qom: move bridge for TypeInfo functions out of pl011, Paolo Bonzini, 2024/12/09