Re: [PATCH v2 01/16] rust/qobject: add basic bindings
Markus Armbruster <[email protected]> Tue, 24 Feb 2026 14:33:26 +0100
| Newsgroups | org.nongnu.qemu-rust,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
Paolo Bonzini <[email protected]> writes: > 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. Thanks! >>> +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. I feel making it inline was a bit silly. Perhaps I had a non-silly reason back then, but I can't see it anymore. Up to you.