From 271321093826c384bf3750c052735a679a6c0259 Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Thu, 21 Mar 2024 16:02:15 -0400 Subject: [PATCH] feat: impl AsRef for Bytes32 and Bytes48 --- bindings/rust/src/bindings/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bindings/rust/src/bindings/mod.rs b/bindings/rust/src/bindings/mod.rs index e9362fcf8..e31cd0b18 100644 --- a/bindings/rust/src/bindings/mod.rs +++ b/bindings/rust/src/bindings/mod.rs @@ -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 {