diff options
| author | Jack O'Connor <[email protected]> | 2024-07-09 19:13:32 -0700 |
|---|---|---|
| committer | Jack O'Connor <[email protected]> | 2024-07-09 19:20:48 -0700 |
| commit | dd0afd640ad97b5ebcf887107162009a23ffdca0 (patch) | |
| tree | 9c5207791e710d24163a808f742400993ec1022d /src/lib.rs | |
| parent | 7ff69443d018f46e52f7678ed42c2b812c002805 (diff) | |
serialize Hash with serde_bytes
Closes #412.
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -219,7 +219,12 @@ fn counter_high(counter: u64) -> u32 { #[cfg_attr(feature = "zeroize", derive(zeroize::Zeroize))] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[derive(Clone, Copy, Hash)] -pub struct Hash([u8; OUT_LEN]); +pub struct Hash( + #[rustfmt::skip] + // In formats like CBOR, bytestrings are more compact than lists of ints. + #[cfg_attr(feature = "serde", serde(with = "serde_bytes"))] + [u8; OUT_LEN], +); impl Hash { /// The raw bytes of the `Hash`. Note that byte arrays don't provide |
