qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PULL 25/41] rust: qom: put class_init together from multiple ClassI


From: Paolo Bonzini
Subject: Re: [PULL 25/41] rust: qom: put class_init together from multiple ClassInitImpl<>
Date: Tue, 7 Jan 2025 17:03:23 +0100

On Tue, Jan 7, 2025 at 4:37 PM Zhao Liu <zhao1.liu@intel.com> wrote:
> > If anybody wants to do it as an exercise, I am happy to help, otherwise I
> > can prepare a patch too.
>
> If possible and if no one else wants to practice, I would also like to
> give it a try (I'll add it to my list).

Hmm, thinking more about it, it does require a bit that is slightly
more complicated than I anticipated, which is a binding to
object_class_dynamic_cast(). I placed something completely untested
(except it compiles...) in rust-next. It uses a new trait
InterfaceType that can be used as

    ResettableClass::interface_init::<T, DeviceState>(dc);

but I don't really like the two parameters and also I don't like that
class_init is called differently for classes and interfaces. It's
probably possible to design a better API, but I didn't spend too much
time on it because it may require rethinking how classes are declared
(not a huge deal, as we have only four of them).

Feel free to give it a try, but it seems like a relatively low
priority item compared to upstreaming timers (i.e. HPET) and
MemoryRegionOps; or figuring out logging.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]