Skip to content

Commit 3996967

Browse files
committed
digest: Add Hash derives
I hit this when porting ocidir-rs; previously strings were hashable and it clearly makes sense for digests to be. Signed-off-by: Colin Walters <[email protected]>
1 parent 610da48 commit 3996967

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/image/digest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::str::FromStr;
99
/// standards. Other digest algorithms may be added
1010
/// in the future, so this structure is marked as non-exhaustive.
1111
#[non_exhaustive]
12-
#[derive(Clone, Debug, PartialEq, Eq)]
12+
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
1313
pub enum DigestAlgorithm {
1414
/// The SHA-256 algorithm.
1515
Sha256,
@@ -95,7 +95,7 @@ fn char_is_encoded(c: char) -> bool {
9595
/// # }
9696
/// ```
9797
98-
#[derive(Clone, Debug, Eq, PartialEq)]
98+
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
9999
pub struct Digest {
100100
/// The algorithm
101101
algorithm: DigestAlgorithm,
@@ -202,7 +202,7 @@ impl FromStr for Digest {
202202
}
203203

204204
/// A SHA-256 digest, guaranteed to be 64 lowercase hexadecimal ASCII characters.
205-
#[derive(Clone, Debug, Eq, PartialEq)]
205+
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
206206
pub struct Sha256Digest {
207207
digest: Box<str>,
208208
}

0 commit comments

Comments
 (0)