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 <noreply+kokoro@google.com>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
This commit is contained in:
Dylan Reid 2020-06-28 14:36:08 -07:00 committed by Commit Bot
parent a70743b271
commit fc5220e4df

View file

@ -267,6 +267,19 @@ impl<F: AsRawFd + Unpin> U64Source<F> {
} }
} }
impl<F: AsRawFd + Unpin> std::ops::Deref for U64Source<F> {
type Target = F;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl<F: AsRawFd + Unpin> std::ops::DerefMut for U64Source<F> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::fs::{File, OpenOptions}; use std::fs::{File, OpenOptions};