Re: [PATCH 07/14] rust: add Deserializer (from_qobject) implementation for QObject
Zhao Liu <[email protected]>
| Newsgroups | org.nongnu.qemu-rust,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Oct 01, 2025 at 10:00:44AM +0200, Paolo Bonzini wrote: > Date: Wed, 1 Oct 2025 10:00:44 +0200 > From: Paolo Bonzini <[email protected]> > Subject: [PATCH 07/14] rust: add Deserializer (from_qobject) implementation > for QObject > X-Mailer: git-send-email 2.51.0 > > This allows creating any serializable data structure from QObject. > > Co-authored-by: Marc-André Lureau <[email protected]> > Signed-off-by: Marc-André Lureau <[email protected]> > Signed-off-by: Paolo Bonzini <[email protected]> > --- > docs/devel/rust.rst | 1 + > rust/util/meson.build | 1 + > rust/util/src/qobject/deserializer.rs | 373 ++++++++++++++++++++++++++ > rust/util/src/qobject/error.rs | 8 +- > rust/util/src/qobject/mod.rs | 2 + > 5 files changed, 384 insertions(+), 1 deletion(-) > create mode 100644 rust/util/src/qobject/deserializer.rs ... > diff --git a/rust/util/src/qobject/deserializer.rs b/rust/util/src/qobject/deserializer.rs > new file mode 100644 > index 00000000000..a2fe417e72a > --- /dev/null > +++ b/rust/util/src/qobject/deserializer.rs > @@ -0,0 +1,373 @@ > +//! `QObject` deserializer > +//! > +//! This module implements a [`Deserializer`](serde::de::Deserializer) that > +//! produces `QObject`s, allowing them to be turned into deserializable data ^^^^^^^^ Only a nit, This "produces" word puzzled me for a while. I think it should be "consumes". Then the logic of 4 things did in this series should be the following? serializer serialize Rust struct ----------> QObject ---------> JSON <---------- <--------- deserializer deserialize Maybe we could have the similar documentation/decription in mod.rs or somewhere to provide a high-level overview :). > +//! structures (such as primitive data types, or structs that implement > +//! `Deserialize`). > + The implementation itself looks good, Reviewed-by: Zhao Liu <[email protected]>