feat: impl AsRef for Bytes32 and Bytes48 (#411)

This commit is contained in:
Dan Cline 2024-03-22 09:33:41 -04:00 committed by GitHub
parent f345b66f53
commit 6164f277d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 0 deletions

View File

@ -508,12 +508,24 @@ impl From<[u8; 32]> for Bytes32 {
}
}
impl AsRef<[u8; 32]> for Bytes32 {
fn as_ref(&self) -> &[u8; 32] {
&self.bytes
}
}
impl From<[u8; 48]> for Bytes48 {
fn from(value: [u8; 48]) -> Self {
Self { bytes: value }
}
}
impl AsRef<[u8; 48]> for Bytes48 {
fn as_ref(&self) -> &[u8; 48] {
&self.bytes
}
}
impl Deref for Bytes32 {
type Target = [u8; 32];
fn deref(&self) -> &Self::Target {