Merge rust-bitcoin/rust-bitcoin#1301: `AsMut` impls for `Magic`

bfb4977be9 implement `AsMut<[u8]>` and `AsMut<[u8;4]>` for `Magic` (Noah)

Pull request description:

  Follow up to https://github.com/rust-bitcoin/rust-bitcoin/pull/1288#discussion_r982152738

  Implemented `AsMut<[u8]>` and `AsMut<[u8;4]>` for `Magic`.

ACKs for top commit:
  Kixunil:
    ACK bfb4977be9
  apoelstra:
    ACK bfb4977be9

Tree-SHA512: f1732f2b6db285e64baf07e70917eb8c0938b3a8d11f8266c0f2c846b7b2d4447cb99721b55c9db877f88c398dd74477c41bdae34679b6c3b6ade71455538241
This commit is contained in:
Andrew Poelstra 2022-09-29 13:29:41 +00:00
commit f6d838076e
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 12 additions and 0 deletions

View File

@ -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 { impl Borrow<[u8]> for Magic {
fn borrow(&self) -> &[u8] { fn borrow(&self) -> &[u8] {
&self.0 &self.0