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 <pbonz...@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 <pbonz...@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....@intel.com>