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

This commit is contained in:
Noah 2022-09-29 16:04:37 +10:00
parent 6e5e8d80a6
commit bfb4977be9
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