From bfb4977be9e29754b0f89c6d3773ca81b7c36108 Mon Sep 17 00:00:00 2001 From: Noah <34389972+nlanson@users.noreply.github.com> Date: Thu, 29 Sep 2022 16:04:37 +1000 Subject: [PATCH] implement `AsMut<[u8]>` and `AsMut<[u8;4]>` for `Magic` --- bitcoin/src/network/constants.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bitcoin/src/network/constants.rs b/bitcoin/src/network/constants.rs index 7795d3a5..614b642a 100644 --- a/bitcoin/src/network/constants.rs +++ b/bitcoin/src/network/constants.rs @@ -265,6 +265,18 @@ impl AsRef<[u8; 4]> for Magic { } } +impl AsMut<[u8]> for Magic { + fn as_mut(&mut self) -> &mut [u8] { + &mut self.0 + } +} + +impl AsMut<[u8; 4]> for Magic { + fn as_mut(&mut self) -> &mut [u8; 4] { + &mut self.0 + } +} + impl Borrow<[u8]> for Magic { fn borrow(&self) -> &[u8] { &self.0