zircon-syscall: better debug format for Deadline
use {
super::*,
core::{
+ fmt::{Debug, Formatter, Result},
sync::atomic::{AtomicU64, Ordering},
time::Duration,
},
@@ -68,7 +69,6 @@ impl Syscall<'_> {
}
#[repr(transparent)]
-#[derive(Debug)]
pub struct Deadline(i64);
impl From<usize> for Deadline {
@@ -88,3 +88,15 @@ impl From<Deadline> for Duration {
Duration::from_nanos(deadline.0.max(0) as u64)
}
}
+
+impl Debug for Deadline {
+ fn fmt(&self, f: &mut Formatter<'_>) -> Result {
+ if self.0 <= 0 {
+ write!(f, "NoWait")
+ } else if self.0 == i64::max_value() {
+ write!(f, "Forever")
+ } else {
+ write!(f, "At({:?})", Duration::from_nanos(self.0 as u64))
+ }
+ }
+}
