From fc5220e4df9cd0f1e9ee762b2cbfc173fa98b235 Mon Sep 17 00:00:00 2001 From: Dylan Reid Date: Sun, 28 Jun 2020 14:36:08 -0700 Subject: [PATCH] cros_async: Deref U64Source to the inner source Allow U64Source to Deref to the inner u64 producer. The first user will be asynchronous timers that that need to rearm the inner timer. Change-Id: If23b7a03df5ef407ae7a0c1fdc76d460e628727b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2299842 Tested-by: kokoro Tested-by: Dylan Reid Commit-Queue: Dylan Reid Reviewed-by: Chirantan Ekbote --- cros_async/src/poll_or_ring.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cros_async/src/poll_or_ring.rs b/cros_async/src/poll_or_ring.rs index 73ba4ec1a9..3e255d0782 100644 --- a/cros_async/src/poll_or_ring.rs +++ b/cros_async/src/poll_or_ring.rs @@ -267,6 +267,19 @@ impl U64Source { } } +impl std::ops::Deref for U64Source { + type Target = F; + fn deref(&self) -> &Self::Target { + &self.inner + } +} + +impl std::ops::DerefMut for U64Source { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.inner + } +} + #[cfg(test)] mod tests { use std::fs::{File, OpenOptions};