diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2024-10-28 14:42:23 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2024-12-10 18:49:26 +0100 |
commit | c6c4f3e0d90990c642523c087482eac3f42566c1 (patch) | |
tree | 3e0b247f9cd6f5977a56d596626d048d38f9f461 /rust/hw | |
parent | 3701fb22dfd438993e76e158beb97683359d1dd9 (diff) | |
download | qemu-c6c4f3e0d90990c642523c087482eac3f42566c1.zip qemu-c6c4f3e0d90990c642523c087482eac3f42566c1.tar.gz qemu-c6c4f3e0d90990c642523c087482eac3f42566c1.tar.bz2 |
rust: qom: move ClassInitImpl to the instance side
Put all traits on the instance struct, which makes it possible to reuse
class structs if no new virtual methods or class fields are added.
This is almost always the case for devices (because they are leaf
classes), which is the primary use case for Rust.
This is also simpler: soon we will find the implemented methods without
macros, and this removes the need to go from the class struct to the
instance struct to find the implementation of the *Impl traits.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'rust/hw')
-rw-r--r-- | rust/hw/char/pl011/src/device.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/rust/hw/char/pl011/src/device.rs b/rust/hw/char/pl011/src/device.rs index bcb146c..2384d4b 100644 --- a/rust/hw/char/pl011/src/device.rs +++ b/rust/hw/char/pl011/src/device.rs @@ -116,7 +116,7 @@ pub struct PL011Class { _inner: [u8; 0], } -impl qemu_api::definitions::ClassInitImpl for PL011Class { +impl qemu_api::definitions::ClassInitImpl for PL011State { const CLASS_INIT: Option<unsafe extern "C" fn(klass: *mut ObjectClass, data: *mut c_void)> = Some(crate::device_class::pl011_class_init); const CLASS_BASE_INIT: Option< @@ -649,7 +649,7 @@ pub unsafe extern "C" fn pl011_luminary_init(obj: *mut Object) { } } -impl qemu_api::definitions::ClassInitImpl for PL011LuminaryClass { +impl qemu_api::definitions::ClassInitImpl for PL011Luminary { const CLASS_INIT: Option<unsafe extern "C" fn(klass: *mut ObjectClass, data: *mut c_void)> = None; const CLASS_BASE_INIT: Option< |