Manually implement AsRef (remove Borrow)

Currently we are using a macro to implement `AsRef` and `Borrow` for
`sha256::Midstate`.

In preparation for adding a length field to the `Midstate` remove the
implementation of `Borrow` but keep `AsRef`.

API breaking change.
This commit is contained in:
Tobin C. Harding 2024-07-11 14:08:31 +10:00
parent 7dc68b62e9
commit ca823945fc
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 4 additions and 2 deletions

View File

@ -8,7 +8,7 @@ use core::arch::x86::*;
use core::arch::x86_64::*;
use core::ops::Index;
use core::slice::SliceIndex;
use core::{cmp, fmt};
use core::{cmp, convert, fmt};
#[cfg(doc)]
use crate::sha256t;
@ -198,7 +198,9 @@ impl fmt::Debug for Midstate {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:#}", self) }
}
borrow_slice_impl!(Midstate);
impl convert::AsRef<[u8]> for Midstate {
fn as_ref(&self) -> &[u8] { &self.0 }
}
impl<I: SliceIndex<[u8]>> Index<I> for Midstate {
type Output = I::Output;