Skip to content

RFC rust: Make common::Wrapper work with non-tuple structs

Martin Kletzander qemu-devel qemu-rust 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2rust: Make common::Wrapper work with non-tuple structs as wellrust/qemu-macros/src/lib.rs+37 -120 replies
2/2rust/util: Change Timer and TimerListGroup to normal structsrust/util/src/timer.rs+7 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/2] rust: Make common::Wrapper work with non-tuple structs

As part of my "investigation" [0] into safer object initialization using pinned-init, I found out that pinned-init will probably not work with tuple structs for some time [1]. So I figured out how to change QEMU's Wrapper derive macro so that both tuple structs and classic structs (still #[repr(transparent)] and having only one member) are supported.

The second patch is there just to show that it works, I also checked the result with cargo expand to make sure.

This is just to see if the patch makes sense the way it is. I'm still trying to see the best way forward with this pinning effort. Many thanks for Paolo's patience with me. I'm using what I learn to also try and make a proof of concept of something similar to the RustInQEMU effort (although way smaller in scope) in libvirt, so it takes a bit more time.

[0] read: learning QEMU internals and possible Rust usage
[1] https://github.com/Rust-for-Linux/pin-init/issues/85

Martin Kletzander (2):
rust: Make common::Wrapper work with non-tuple structs as well rust/util: Change Timer and TimerListGroup to normal structs

 rust/qemu-macros/src/lib.rs | 49 ++++++++++++++++++++++++++++---------
 rust/util/src/timer.rs      | 10 +++++---
 2 files changed, 44 insertions(+), 15 deletions(-)
Signature · 1 line
2.51.0