Skip to content

Commit 8de5e2c

Browse files
committed
feat: implement Borrow<[u8]> for Multihash
1 parent a37ddc7 commit 8de5e2c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/digests.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::borrow::Borrow;
12
use std::convert::TryFrom;
23
use std::{cmp, fmt, hash};
34

@@ -86,6 +87,12 @@ impl AsRef<[u8]> for Multihash {
8687
}
8788
}
8889

90+
impl Borrow<[u8]> for Multihash {
91+
fn borrow(&self) -> &[u8] {
92+
self.as_bytes()
93+
}
94+
}
95+
8996
impl<'a> PartialEq<MultihashRef<'a>> for Multihash {
9097
fn eq(&self, other: &MultihashRef<'a>) -> bool {
9198
&*self.as_bytes() == other.as_bytes()

0 commit comments

Comments
 (0)