On Fri, Jun 13, 2025 at 7:36 AM Zhao Liu <zhao1....@intel.com> wrote:
> > 1) everything is done through an intermediate QObject step (e.g. for a
> > setter: Visitor->QObject with an input visitor, and QObject->Rust with
> > serde deserialization).
> >     + easy, Rust only sees serde
> >     + QMP commands use a single conversion step
> >     - inefficient
>
> This sounds like a natural approach.

Yep, serde is complex but the result is very natural. In some cases
serde has different defaults than QEMU, but attributes like
#[serde(skip_serializing_if = "Option::is_none")] can be automatically
generated by qapi-gen.

> > 2) everything is done through an intermediate C step (e.g. for a
> > setter: Visitor->C with a visit_type_* function, and C->Rust with
> > generated code that does not need to use serde).
>
> I understand this step indicates to use bindgen to generate visit_type_*
> bindings...

More than that, it's using qapi-gen to generate implementations like
the *Foreign traits used by Error. Marc-André wrote his own traits but
I suspect a lot of the code could be reused.

So I must give credit to Marc-André that there is a big advantage
here, in that a lot of the code is already written and it is simpler
than serde.

Paolo


Reply via email to