mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 20:33:54 -06:00
rust: qom: get rid of ClassInitImpl
Complete the conversion from the ClassInitImpl trait to class_init() methods. This will provide more freedom to split the qemu_api crate in separate parts. Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
567c0c41a6
commit
d556226d69
6 changed files with 101 additions and 130 deletions
|
@ -14,8 +14,8 @@ use crate::{
|
|||
irq::{IRQState, InterruptSource},
|
||||
memory::MemoryRegion,
|
||||
prelude::*,
|
||||
qdev::{DeviceClass, DeviceImpl, DeviceState},
|
||||
qom::{ClassInitImpl, Owned},
|
||||
qdev::{DeviceImpl, DeviceState},
|
||||
qom::Owned,
|
||||
};
|
||||
|
||||
unsafe impl ObjectType for SysBusDevice {
|
||||
|
@ -28,12 +28,11 @@ qom_isa!(SysBusDevice: DeviceState, Object);
|
|||
// TODO: add virtual methods
|
||||
pub trait SysBusDeviceImpl: DeviceImpl + IsA<SysBusDevice> {}
|
||||
|
||||
impl<T> ClassInitImpl<SysBusDeviceClass> for T
|
||||
where
|
||||
T: SysBusDeviceImpl + ClassInitImpl<DeviceClass>,
|
||||
{
|
||||
fn class_init(sdc: &mut SysBusDeviceClass) {
|
||||
<T as ClassInitImpl<DeviceClass>>::class_init(&mut sdc.parent_class);
|
||||
impl SysBusDeviceClass {
|
||||
/// Fill in the virtual methods of `SysBusDeviceClass` based on the
|
||||
/// definitions in the `SysBusDeviceImpl` trait.
|
||||
pub fn class_init<T: SysBusDeviceImpl>(self: &mut SysBusDeviceClass) {
|
||||
self.parent_class.class_init::<T>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue