From: Martin Kletzander <mkletzan@redhat.com>
To: 'Manos Pitsidianakis ' <manos.pitsidianakis@linaro.org>,
qemu-rust@nongnu.org, qemu-devel@nongnu.org
Subject: [RFC PATCH 2/2] rust/util: Change Timer and TimerListGroup to normal structs
Date: Thu, 23 Oct 2025 15:54:09 +0200 [thread overview]
Message-ID: <b21bfbd144b1a4ecbe4b9e0323a0f57c35c6e47d.1761226974.git.mkletzan@redhat.com> (raw)
In-Reply-To: <cover.1761226974.git.mkletzan@redhat.com>
From: Martin Kletzander <mkletzan@redhat.com>
This will allow the use of pinned_init crate which does not support
tuple structs.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
rust/util/src/timer.rs | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/rust/util/src/timer.rs b/rust/util/src/timer.rs
index a99ff5e7ef7a..bc6297214525 100644
--- a/rust/util/src/timer.rs
+++ b/rust/util/src/timer.rs
@@ -17,14 +17,18 @@
/// A safe wrapper around [`bindings::QEMUTimer`].
#[repr(transparent)]
#[derive(Debug, common::Wrapper)]
-pub struct Timer(Opaque<bindings::QEMUTimer>);
+pub struct Timer {
+ inner: Opaque<bindings::QEMUTimer>,
+}
unsafe impl Send for Timer {}
unsafe impl Sync for Timer {}
#[repr(transparent)]
#[derive(common::Wrapper)]
-pub struct TimerListGroup(Opaque<bindings::QEMUTimerListGroup>);
+pub struct TimerListGroup {
+ inner: Opaque<bindings::QEMUTimerListGroup>,
+}
unsafe impl Send for TimerListGroup {}
unsafe impl Sync for TimerListGroup {}
@@ -42,7 +46,7 @@ impl Timer {
/// [`modify`](Self::modify).
pub const unsafe fn new() -> Self {
// SAFETY: requirements relayed to callers of Timer::new
- Self(unsafe { Opaque::zeroed() })
+ Self { inner: unsafe { Opaque::zeroed() } }
}
/// Create a new timer with the given attributes.
--
2.51.0
prev parent reply other threads:[~2025-10-23 13:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-23 13:54 [RFC PATCH 0/2] rust: Make common::Wrapper work with non-tuple structs Martin Kletzander
2025-10-23 13:54 ` [RFC PATCH 1/2] rust: Make common::Wrapper work with non-tuple structs as well Martin Kletzander
2025-10-23 13:54 ` Martin Kletzander [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b21bfbd144b1a4ecbe4b9e0323a0f57c35c6e47d.1761226974.git.mkletzan@redhat.com \
--to=mkletzan@redhat.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).