Re: [PATCH v2 01/16] rust/qobject: add basic bindings

Paolo Bonzini
2026-02-24T10:36:07Z

On 2/24/26 11:03, Markus Armbruster wrote:
>> diff --git a/rust/util/wrapper.h b/rust/util/wrapper.h
>> index b9ed68a01d8..0907dd59142 100644
>> --- a/rust/util/wrapper.h
>> +++ b/rust/util/wrapper.h
>> @@ -30,3 +30,10 @@ typedef enum memory_order {
>> #include "qemu/log.h"
>> #include "qemu/module.h"
>> #include "qemu/timer.h"
>> +#include "qobject/qnull.h"
>> +#include "qobject/qbool.h"
>> +#include "qobject/qnum.h"
>> +#include "qobject/qstring.h"
>> +#include "qobject/qobject.h"
>> +#include "qobject/qlist.h"
>> +#include "qobject/qdict.h"
>
> Is this file just for bindgen, and never actually fed to the C compiler?

Yes.

>> +impl From<()> for QObject {
>> + fn from(_null: ()) -> Self {
>> + // Conversion of the C inline `qnull` function
>> + unsafe { QObject::cloned_from_base(addr_of!(bindings::qnull_.base)) }
>> + }
>> +}
>
> Could we call C qnull() instead of using qnull_.base?

See v1 review - no, because qnull() is inline. I can make it not
inline, of course.

Paolo