[PATCH 07/10] rust: qdev: make ObjectImpl a supertrait of DeviceImpl

Paolo Bonzini posted 10 patches 2 weeks, 4 days ago
[PATCH 07/10] rust: qdev: make ObjectImpl a supertrait of DeviceImpl
Posted by Paolo Bonzini 2 weeks, 4 days ago
In practice it has to be implemented always in order to access an
implementation of ClassInitImpl<ObjectClass>.  Make the relationship
explicit in the code.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 rust/qemu-api/src/qdev.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rust/qemu-api/src/qdev.rs b/rust/qemu-api/src/qdev.rs
index f573712550e..ab883e2faef 100644
--- a/rust/qemu-api/src/qdev.rs
+++ b/rust/qemu-api/src/qdev.rs
@@ -21,7 +21,7 @@
 };
 
 /// Trait providing the contents of [`DeviceClass`].
-pub trait DeviceImpl {
+pub trait DeviceImpl: ObjectImpl {
     /// _Realization_ is the second stage of device creation. It contains
     /// all operations that depend on device properties and can fail (note:
     /// this is not yet supported for Rust devices).
-- 
2.47.1
Re: [PATCH 07/10] rust: qdev: make ObjectImpl a supertrait of DeviceImpl
Posted by Zhao Liu 1 week, 2 days ago
On Fri, Jan 17, 2025 at 08:40:00PM +0100, Paolo Bonzini wrote:
> Date: Fri, 17 Jan 2025 20:40:00 +0100
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH 07/10] rust: qdev: make ObjectImpl a supertrait of
>  DeviceImpl
> X-Mailer: git-send-email 2.47.1
> 
> In practice it has to be implemented always in order to access an
> implementation of ClassInitImpl<ObjectClass>.  Make the relationship
> explicit in the code.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  rust/qemu-api/src/qdev.rs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

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