mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 20:33:54 -06:00
rust: add SysBusDeviceImpl
The only function, right now, is to ensure that anything with a SysBusDeviceClass class is a SysBusDevice. Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
ac5699c5da
commit
3212da0033
3 changed files with 12 additions and 5 deletions
|
@ -14,7 +14,7 @@ use crate::{
|
|||
irq::{IRQState, InterruptSource},
|
||||
memory::MemoryRegion,
|
||||
prelude::*,
|
||||
qdev::{DeviceClass, DeviceState},
|
||||
qdev::{DeviceClass, DeviceImpl, DeviceState},
|
||||
qom::{ClassInitImpl, Owned},
|
||||
};
|
||||
|
||||
|
@ -25,10 +25,12 @@ unsafe impl ObjectType for SysBusDevice {
|
|||
}
|
||||
qom_isa!(SysBusDevice: DeviceState, Object);
|
||||
|
||||
// TODO: add SysBusDeviceImpl
|
||||
// TODO: add virtual methods
|
||||
pub trait SysBusDeviceImpl: DeviceImpl + IsA<SysBusDevice> {}
|
||||
|
||||
impl<T> ClassInitImpl<SysBusDeviceClass> for T
|
||||
where
|
||||
T: ClassInitImpl<DeviceClass>,
|
||||
T: SysBusDeviceImpl + ClassInitImpl<DeviceClass>,
|
||||
{
|
||||
fn class_init(sdc: &mut SysBusDeviceClass) {
|
||||
<T as ClassInitImpl<DeviceClass>>::class_init(&mut sdc.parent_class);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue