Skip to content

Commit

Permalink
prost-type: impl Hash for Duration (#912)
Browse files Browse the repository at this point in the history
Co-authored-by: Quentin Perez <qp@amo.co>
  • Loading branch information
Quentin Perez and Quentin Perez authored Sep 15, 2023
1 parent b258dc8 commit bf86646
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions prost-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ impl Name for Any {
}
}

#[cfg(feature = "std")]
impl std::hash::Hash for Duration {
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
self.seconds.hash(state);
self.nanos.hash(state);
}
}

impl Duration {
/// Normalizes the duration to a canonical format.
///
Expand Down

0 comments on commit bf86646

Please sign in to comment.