Merge branch 'main' into notify_barrier

This commit is contained in:
Mathieu Trossevin 2024-01-05 22:41:13 +01:00
commit cfac28272b
2 changed files with 10 additions and 9 deletions

View file

@ -349,11 +349,11 @@ pub enum NotifyState<'a> {
/// Tell the service manager to execute the configured watchdog option. /// Tell the service manager to execute the configured watchdog option.
WatchdogTrigger, WatchdogTrigger,
/// Reset watchdog timeout value during runtime. /// Reset watchdog timeout value during runtime.
/// The value is in milliseconds. /// The value is in microseconds.
WatchdogUsec(types::Milliseconds), WatchdogUsec(types::Microseconds),
/// Tells the service manager to extend the startup, runtime or shutdown service timeout corresponding the current state. /// Tells the service manager to extend the startup, runtime or shutdown service timeout corresponding the current state.
/// The value is in milliseconds. /// The value is in microseconds.
ExtendTimeoutUsec(types::Milliseconds), ExtendTimeoutUsec(types::Microseconds),
} }
impl<'a> Display for NotifyState<'a> { impl<'a> Display for NotifyState<'a> {

View file

@ -86,22 +86,23 @@ impl Display for StatusLine<'_> {
} }
} }
/// Semantic type representing a number of microseconds.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Milliseconds(u64); pub struct Microseconds(u64);
impl From<u64> for Milliseconds { impl From<u64> for Microseconds {
fn from(value: u64) -> Self { fn from(value: u64) -> Self {
Self(value) Self(value)
} }
} }
impl From<Milliseconds> for u64 { impl From<Microseconds> for u64 {
fn from(value: Milliseconds) -> Self { fn from(value: Microseconds) -> Self {
value.0 value.0
} }
} }
impl Display for Milliseconds { impl Display for Microseconds {
#[inline] #[inline]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
Display::fmt(&self.0, f) Display::fmt(&self.0, f)