Skip to content

Commit

Permalink
feat(errors): Impl Default for error types
Browse files Browse the repository at this point in the history
  • Loading branch information
PTaylor-us committed Aug 6, 2020
1 parent 785d908 commit e035d57
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ pub enum Error {
NotRunning,
}

impl Default for Error {
fn default() -> Self {
Self::Unspecified
}
}

/// The `Clock` trait provides an abstraction for hardware-specific timer peripherals, external
/// timer devices, RTCs, etc.
///
Expand Down
12 changes: 12 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ impl From<clock::Error> for TimeError {
}
}

impl Default for TimeError {
fn default() -> Self {
Self::Unspecified
}
}

/// Conversion errors
#[non_exhaustive]
#[derive(Debug, Eq, PartialEq, Hash)]
Expand Down Expand Up @@ -137,5 +143,11 @@ impl From<ConversionError> for TimeError {
}
}

impl Default for ConversionError {
fn default() -> Self {
Self::Unspecified
}
}

#[cfg(test)]
mod tests {}

0 comments on commit e035d57

Please sign in to comment.