[RFC PATCH 2/2] rust/util: Change Timer and TimerListGroup to normal structs

Martin Kletzander posted 2 patches 3 days, 21 hours ago
Maintainers: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
[RFC PATCH 2/2] rust/util: Change Timer and TimerListGroup to normal structs
Posted by Martin Kletzander 3 days, 21 hours ago
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