hashes: use workaround to get constfns on tagged hashes with MSRV
As you can see from the - lines in the API diff, there is no reduction in API surface (we just remove the T:Tag bound from the sha256t::Tag type, which is not strictly necessary but maybe we would prefer to keep).
This commit is contained in:
parent
9ba29b384e
commit
c155cbf8b2
|
@ -5,7 +5,7 @@
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha1::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha1::Hash(_)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha256::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha256::Hash(_)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha256d::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha256d::Hash(_)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha256t::Hash<T: bitcoin_hashes::sha256t::Tag>(_, _)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha256t::Hash<T>(_, _)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha384::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha384::Hash(_)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha512::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha512::Hash(_)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha512_256::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha512_256::Hash(_)
|
||||||
|
@ -431,7 +431,6 @@ impl<T: bitcoin_hashes::Hash> core::marker::StructuralPartialEq for bitcoin_hash
|
||||||
impl<T: bitcoin_hashes::Hash> std::io::Write for bitcoin_hashes::hmac::HmacEngine<T>
|
impl<T: bitcoin_hashes::Hash> std::io::Write for bitcoin_hashes::hmac::HmacEngine<T>
|
||||||
impl<T: bitcoin_hashes::sha256t::Tag> bitcoin_hashes::Hash for bitcoin_hashes::sha256t::Hash<T>
|
impl<T: bitcoin_hashes::sha256t::Tag> bitcoin_hashes::Hash for bitcoin_hashes::sha256t::Hash<T>
|
||||||
impl<T: bitcoin_hashes::sha256t::Tag> bitcoin_hashes::serde_macros::serde_details::SerdeHash for bitcoin_hashes::sha256t::Hash<T>
|
impl<T: bitcoin_hashes::sha256t::Tag> bitcoin_hashes::serde_macros::serde_details::SerdeHash for bitcoin_hashes::sha256t::Hash<T>
|
||||||
impl<T: bitcoin_hashes::sha256t::Tag> bitcoin_hashes::sha256t::Hash<T>
|
|
||||||
impl<T: bitcoin_hashes::sha256t::Tag> core::borrow::Borrow<[u8]> for bitcoin_hashes::sha256t::Hash<T>
|
impl<T: bitcoin_hashes::sha256t::Tag> core::borrow::Borrow<[u8]> for bitcoin_hashes::sha256t::Hash<T>
|
||||||
impl<T: bitcoin_hashes::sha256t::Tag> core::clone::Clone for bitcoin_hashes::sha256t::Hash<T>
|
impl<T: bitcoin_hashes::sha256t::Tag> core::clone::Clone for bitcoin_hashes::sha256t::Hash<T>
|
||||||
impl<T: bitcoin_hashes::sha256t::Tag> core::cmp::Eq for bitcoin_hashes::sha256t::Hash<T>
|
impl<T: bitcoin_hashes::sha256t::Tag> core::cmp::Eq for bitcoin_hashes::sha256t::Hash<T>
|
||||||
|
@ -458,6 +457,8 @@ impl<T: core::cmp::PartialEq + bitcoin_hashes::Hash> core::cmp::PartialEq for bi
|
||||||
impl<T: core::cmp::PartialOrd + bitcoin_hashes::Hash> core::cmp::PartialOrd for bitcoin_hashes::hmac::Hmac<T>
|
impl<T: core::cmp::PartialOrd + bitcoin_hashes::Hash> core::cmp::PartialOrd for bitcoin_hashes::hmac::Hmac<T>
|
||||||
impl<T: core::hash::Hash + bitcoin_hashes::Hash> core::hash::Hash for bitcoin_hashes::hmac::Hmac<T>
|
impl<T: core::hash::Hash + bitcoin_hashes::Hash> core::hash::Hash for bitcoin_hashes::hmac::Hmac<T>
|
||||||
impl<T: core::marker::Copy + bitcoin_hashes::Hash> core::marker::Copy for bitcoin_hashes::hmac::Hmac<T>
|
impl<T: core::marker::Copy + bitcoin_hashes::Hash> core::marker::Copy for bitcoin_hashes::hmac::Hmac<T>
|
||||||
|
impl<T> bitcoin_hashes::sha256t::Hash<T> where (T): bitcoin_hashes::sha256t::Tag
|
||||||
|
impl<T> bitcoin_hashes::sha256t::Tag for (T) where T: bitcoin_hashes::sha256t::Tag
|
||||||
impl<T> core::marker::Freeze for bitcoin_hashes::hkdf::Hkdf<T> where T: core::marker::Freeze
|
impl<T> core::marker::Freeze for bitcoin_hashes::hkdf::Hkdf<T> where T: core::marker::Freeze
|
||||||
impl<T> core::marker::Freeze for bitcoin_hashes::hmac::Hmac<T> where T: core::marker::Freeze
|
impl<T> core::marker::Freeze for bitcoin_hashes::hmac::Hmac<T> where T: core::marker::Freeze
|
||||||
impl<T> core::marker::Freeze for bitcoin_hashes::hmac::HmacEngine<T> where <T as bitcoin_hashes::Hash>::Engine: core::marker::Freeze
|
impl<T> core::marker::Freeze for bitcoin_hashes::hmac::HmacEngine<T> where <T as bitcoin_hashes::Hash>::Engine: core::marker::Freeze
|
||||||
|
@ -578,6 +579,7 @@ pub const fn bitcoin_hashes::siphash24::HashEngine::new() -> bitcoin_hashes::sip
|
||||||
pub const fn bitcoin_hashes::siphash24::HashEngine::with_keys(k0: u64, k1: u64) -> bitcoin_hashes::siphash24::HashEngine
|
pub const fn bitcoin_hashes::siphash24::HashEngine::with_keys(k0: u64, k1: u64) -> bitcoin_hashes::siphash24::HashEngine
|
||||||
pub extern crate bitcoin_hashes::hex
|
pub extern crate bitcoin_hashes::hex
|
||||||
pub extern crate bitcoin_hashes::serde
|
pub extern crate bitcoin_hashes::serde
|
||||||
|
pub fn (T)::engine() -> bitcoin_hashes::sha256::HashEngine
|
||||||
pub fn bitcoin_hashes::FromSliceError::clone(&self) -> bitcoin_hashes::FromSliceError
|
pub fn bitcoin_hashes::FromSliceError::clone(&self) -> bitcoin_hashes::FromSliceError
|
||||||
pub fn bitcoin_hashes::FromSliceError::eq(&self, other: &bitcoin_hashes::FromSliceError) -> bool
|
pub fn bitcoin_hashes::FromSliceError::eq(&self, other: &bitcoin_hashes::FromSliceError) -> bool
|
||||||
pub fn bitcoin_hashes::FromSliceError::expected_length(&self) -> usize
|
pub fn bitcoin_hashes::FromSliceError::expected_length(&self) -> usize
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha1::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha1::Hash(_)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha256::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha256::Hash(_)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha256d::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha256d::Hash(_)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha256t::Hash<T: bitcoin_hashes::sha256t::Tag>(_, _)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha256t::Hash<T>(_, _)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha384::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha384::Hash(_)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha512::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha512::Hash(_)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha512_256::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha512_256::Hash(_)
|
||||||
|
@ -373,7 +373,6 @@ impl<T: bitcoin_hashes::Hash> core::fmt::Display for bitcoin_hashes::hmac::Hmac<
|
||||||
impl<T: bitcoin_hashes::Hash> core::fmt::LowerHex for bitcoin_hashes::hmac::Hmac<T>
|
impl<T: bitcoin_hashes::Hash> core::fmt::LowerHex for bitcoin_hashes::hmac::Hmac<T>
|
||||||
impl<T: bitcoin_hashes::Hash> core::marker::StructuralPartialEq for bitcoin_hashes::hmac::Hmac<T>
|
impl<T: bitcoin_hashes::Hash> core::marker::StructuralPartialEq for bitcoin_hashes::hmac::Hmac<T>
|
||||||
impl<T: bitcoin_hashes::sha256t::Tag> bitcoin_hashes::Hash for bitcoin_hashes::sha256t::Hash<T>
|
impl<T: bitcoin_hashes::sha256t::Tag> bitcoin_hashes::Hash for bitcoin_hashes::sha256t::Hash<T>
|
||||||
impl<T: bitcoin_hashes::sha256t::Tag> bitcoin_hashes::sha256t::Hash<T>
|
|
||||||
impl<T: bitcoin_hashes::sha256t::Tag> core::borrow::Borrow<[u8]> for bitcoin_hashes::sha256t::Hash<T>
|
impl<T: bitcoin_hashes::sha256t::Tag> core::borrow::Borrow<[u8]> for bitcoin_hashes::sha256t::Hash<T>
|
||||||
impl<T: bitcoin_hashes::sha256t::Tag> core::clone::Clone for bitcoin_hashes::sha256t::Hash<T>
|
impl<T: bitcoin_hashes::sha256t::Tag> core::clone::Clone for bitcoin_hashes::sha256t::Hash<T>
|
||||||
impl<T: bitcoin_hashes::sha256t::Tag> core::cmp::Eq for bitcoin_hashes::sha256t::Hash<T>
|
impl<T: bitcoin_hashes::sha256t::Tag> core::cmp::Eq for bitcoin_hashes::sha256t::Hash<T>
|
||||||
|
@ -398,6 +397,8 @@ impl<T: core::cmp::PartialEq + bitcoin_hashes::Hash> core::cmp::PartialEq for bi
|
||||||
impl<T: core::cmp::PartialOrd + bitcoin_hashes::Hash> core::cmp::PartialOrd for bitcoin_hashes::hmac::Hmac<T>
|
impl<T: core::cmp::PartialOrd + bitcoin_hashes::Hash> core::cmp::PartialOrd for bitcoin_hashes::hmac::Hmac<T>
|
||||||
impl<T: core::hash::Hash + bitcoin_hashes::Hash> core::hash::Hash for bitcoin_hashes::hmac::Hmac<T>
|
impl<T: core::hash::Hash + bitcoin_hashes::Hash> core::hash::Hash for bitcoin_hashes::hmac::Hmac<T>
|
||||||
impl<T: core::marker::Copy + bitcoin_hashes::Hash> core::marker::Copy for bitcoin_hashes::hmac::Hmac<T>
|
impl<T: core::marker::Copy + bitcoin_hashes::Hash> core::marker::Copy for bitcoin_hashes::hmac::Hmac<T>
|
||||||
|
impl<T> bitcoin_hashes::sha256t::Hash<T> where (T): bitcoin_hashes::sha256t::Tag
|
||||||
|
impl<T> bitcoin_hashes::sha256t::Tag for (T) where T: bitcoin_hashes::sha256t::Tag
|
||||||
impl<T> core::marker::Freeze for bitcoin_hashes::hkdf::Hkdf<T> where T: core::marker::Freeze
|
impl<T> core::marker::Freeze for bitcoin_hashes::hkdf::Hkdf<T> where T: core::marker::Freeze
|
||||||
impl<T> core::marker::Freeze for bitcoin_hashes::hmac::Hmac<T> where T: core::marker::Freeze
|
impl<T> core::marker::Freeze for bitcoin_hashes::hmac::Hmac<T> where T: core::marker::Freeze
|
||||||
impl<T> core::marker::Freeze for bitcoin_hashes::hmac::HmacEngine<T> where <T as bitcoin_hashes::Hash>::Engine: core::marker::Freeze
|
impl<T> core::marker::Freeze for bitcoin_hashes::hmac::HmacEngine<T> where <T as bitcoin_hashes::Hash>::Engine: core::marker::Freeze
|
||||||
|
@ -505,6 +506,7 @@ pub const fn bitcoin_hashes::siphash24::Hash::to_byte_array(self) -> [u8; 8]
|
||||||
pub const fn bitcoin_hashes::siphash24::HashEngine::new() -> bitcoin_hashes::siphash24::HashEngine
|
pub const fn bitcoin_hashes::siphash24::HashEngine::new() -> bitcoin_hashes::siphash24::HashEngine
|
||||||
pub const fn bitcoin_hashes::siphash24::HashEngine::with_keys(k0: u64, k1: u64) -> bitcoin_hashes::siphash24::HashEngine
|
pub const fn bitcoin_hashes::siphash24::HashEngine::with_keys(k0: u64, k1: u64) -> bitcoin_hashes::siphash24::HashEngine
|
||||||
pub extern crate bitcoin_hashes::hex
|
pub extern crate bitcoin_hashes::hex
|
||||||
|
pub fn (T)::engine() -> bitcoin_hashes::sha256::HashEngine
|
||||||
pub fn bitcoin_hashes::FromSliceError::clone(&self) -> bitcoin_hashes::FromSliceError
|
pub fn bitcoin_hashes::FromSliceError::clone(&self) -> bitcoin_hashes::FromSliceError
|
||||||
pub fn bitcoin_hashes::FromSliceError::eq(&self, other: &bitcoin_hashes::FromSliceError) -> bool
|
pub fn bitcoin_hashes::FromSliceError::eq(&self, other: &bitcoin_hashes::FromSliceError) -> bool
|
||||||
pub fn bitcoin_hashes::FromSliceError::expected_length(&self) -> usize
|
pub fn bitcoin_hashes::FromSliceError::expected_length(&self) -> usize
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha1::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha1::Hash(_)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha256::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha256::Hash(_)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha256d::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha256d::Hash(_)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha256t::Hash<T: bitcoin_hashes::sha256t::Tag>(_, _)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha256t::Hash<T>(_, _)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha384::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha384::Hash(_)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha512::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha512::Hash(_)
|
||||||
#[repr(transparent)] pub struct bitcoin_hashes::sha512_256::Hash(_)
|
#[repr(transparent)] pub struct bitcoin_hashes::sha512_256::Hash(_)
|
||||||
|
@ -373,7 +373,6 @@ impl<T: bitcoin_hashes::Hash> core::fmt::Display for bitcoin_hashes::hmac::Hmac<
|
||||||
impl<T: bitcoin_hashes::Hash> core::fmt::LowerHex for bitcoin_hashes::hmac::Hmac<T>
|
impl<T: bitcoin_hashes::Hash> core::fmt::LowerHex for bitcoin_hashes::hmac::Hmac<T>
|
||||||
impl<T: bitcoin_hashes::Hash> core::marker::StructuralPartialEq for bitcoin_hashes::hmac::Hmac<T>
|
impl<T: bitcoin_hashes::Hash> core::marker::StructuralPartialEq for bitcoin_hashes::hmac::Hmac<T>
|
||||||
impl<T: bitcoin_hashes::sha256t::Tag> bitcoin_hashes::Hash for bitcoin_hashes::sha256t::Hash<T>
|
impl<T: bitcoin_hashes::sha256t::Tag> bitcoin_hashes::Hash for bitcoin_hashes::sha256t::Hash<T>
|
||||||
impl<T: bitcoin_hashes::sha256t::Tag> bitcoin_hashes::sha256t::Hash<T>
|
|
||||||
impl<T: bitcoin_hashes::sha256t::Tag> core::borrow::Borrow<[u8]> for bitcoin_hashes::sha256t::Hash<T>
|
impl<T: bitcoin_hashes::sha256t::Tag> core::borrow::Borrow<[u8]> for bitcoin_hashes::sha256t::Hash<T>
|
||||||
impl<T: bitcoin_hashes::sha256t::Tag> core::clone::Clone for bitcoin_hashes::sha256t::Hash<T>
|
impl<T: bitcoin_hashes::sha256t::Tag> core::clone::Clone for bitcoin_hashes::sha256t::Hash<T>
|
||||||
impl<T: bitcoin_hashes::sha256t::Tag> core::cmp::Eq for bitcoin_hashes::sha256t::Hash<T>
|
impl<T: bitcoin_hashes::sha256t::Tag> core::cmp::Eq for bitcoin_hashes::sha256t::Hash<T>
|
||||||
|
@ -398,6 +397,8 @@ impl<T: core::cmp::PartialEq + bitcoin_hashes::Hash> core::cmp::PartialEq for bi
|
||||||
impl<T: core::cmp::PartialOrd + bitcoin_hashes::Hash> core::cmp::PartialOrd for bitcoin_hashes::hmac::Hmac<T>
|
impl<T: core::cmp::PartialOrd + bitcoin_hashes::Hash> core::cmp::PartialOrd for bitcoin_hashes::hmac::Hmac<T>
|
||||||
impl<T: core::hash::Hash + bitcoin_hashes::Hash> core::hash::Hash for bitcoin_hashes::hmac::Hmac<T>
|
impl<T: core::hash::Hash + bitcoin_hashes::Hash> core::hash::Hash for bitcoin_hashes::hmac::Hmac<T>
|
||||||
impl<T: core::marker::Copy + bitcoin_hashes::Hash> core::marker::Copy for bitcoin_hashes::hmac::Hmac<T>
|
impl<T: core::marker::Copy + bitcoin_hashes::Hash> core::marker::Copy for bitcoin_hashes::hmac::Hmac<T>
|
||||||
|
impl<T> bitcoin_hashes::sha256t::Hash<T> where (T): bitcoin_hashes::sha256t::Tag
|
||||||
|
impl<T> bitcoin_hashes::sha256t::Tag for (T) where T: bitcoin_hashes::sha256t::Tag
|
||||||
impl<T> core::marker::Freeze for bitcoin_hashes::hkdf::Hkdf<T> where T: core::marker::Freeze
|
impl<T> core::marker::Freeze for bitcoin_hashes::hkdf::Hkdf<T> where T: core::marker::Freeze
|
||||||
impl<T> core::marker::Freeze for bitcoin_hashes::hmac::Hmac<T> where T: core::marker::Freeze
|
impl<T> core::marker::Freeze for bitcoin_hashes::hmac::Hmac<T> where T: core::marker::Freeze
|
||||||
impl<T> core::marker::Freeze for bitcoin_hashes::hmac::HmacEngine<T> where <T as bitcoin_hashes::Hash>::Engine: core::marker::Freeze
|
impl<T> core::marker::Freeze for bitcoin_hashes::hmac::HmacEngine<T> where <T as bitcoin_hashes::Hash>::Engine: core::marker::Freeze
|
||||||
|
@ -505,6 +506,7 @@ pub const fn bitcoin_hashes::siphash24::Hash::to_byte_array(self) -> [u8; 8]
|
||||||
pub const fn bitcoin_hashes::siphash24::HashEngine::new() -> bitcoin_hashes::siphash24::HashEngine
|
pub const fn bitcoin_hashes::siphash24::HashEngine::new() -> bitcoin_hashes::siphash24::HashEngine
|
||||||
pub const fn bitcoin_hashes::siphash24::HashEngine::with_keys(k0: u64, k1: u64) -> bitcoin_hashes::siphash24::HashEngine
|
pub const fn bitcoin_hashes::siphash24::HashEngine::with_keys(k0: u64, k1: u64) -> bitcoin_hashes::siphash24::HashEngine
|
||||||
pub extern crate bitcoin_hashes::hex
|
pub extern crate bitcoin_hashes::hex
|
||||||
|
pub fn (T)::engine() -> bitcoin_hashes::sha256::HashEngine
|
||||||
pub fn bitcoin_hashes::FromSliceError::clone(&self) -> bitcoin_hashes::FromSliceError
|
pub fn bitcoin_hashes::FromSliceError::clone(&self) -> bitcoin_hashes::FromSliceError
|
||||||
pub fn bitcoin_hashes::FromSliceError::eq(&self, other: &bitcoin_hashes::FromSliceError) -> bool
|
pub fn bitcoin_hashes::FromSliceError::eq(&self, other: &bitcoin_hashes::FromSliceError) -> bool
|
||||||
pub fn bitcoin_hashes::FromSliceError::expected_length(&self) -> usize
|
pub fn bitcoin_hashes::FromSliceError::expected_length(&self) -> usize
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub trait Tag {
|
||||||
|
|
||||||
/// Output of the SHA256t hash function.
|
/// Output of the SHA256t hash function.
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct Hash<T: Tag>([u8; 32], PhantomData<T>);
|
pub struct Hash<T>([u8; 32], PhantomData<T>);
|
||||||
|
|
||||||
#[cfg(feature = "schemars")]
|
#[cfg(feature = "schemars")]
|
||||||
impl<T: Tag> schemars::JsonSchema for Hash<T> {
|
impl<T: Tag> schemars::JsonSchema for Hash<T> {
|
||||||
|
@ -36,8 +36,24 @@ impl<T: Tag> schemars::JsonSchema for Hash<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Tag> Hash<T> {
|
// This impl, and the trait bound `(T,): Tag` below, are hacks to allow defining
|
||||||
fn internal_new(arr: [u8; 32]) -> Self { Hash(arr, Default::default()) }
|
// constfns on Hash<T> for a generic T. This trick was discovered by
|
||||||
|
// https://github.com/rust-lang/rust/issues/90912
|
||||||
|
//
|
||||||
|
// When we drop rustc 1.56.1 we will be able to remove this, which will be a
|
||||||
|
// technically breaking change but in practice probably fine to just drop.
|
||||||
|
impl<T> Tag for (T,)
|
||||||
|
where
|
||||||
|
T: Tag,
|
||||||
|
{
|
||||||
|
fn engine() -> sha256::HashEngine { T::engine() }
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> Hash<T>
|
||||||
|
where
|
||||||
|
(T,): Tag,
|
||||||
|
{
|
||||||
|
fn internal_new(arr: [u8; 32]) -> Self { Hash(arr, PhantomData) }
|
||||||
|
|
||||||
/// Zero cost conversion between a fixed length byte array shared reference and
|
/// Zero cost conversion between a fixed length byte array shared reference and
|
||||||
/// a shared reference to this Hash type.
|
/// a shared reference to this Hash type.
|
||||||
|
@ -54,7 +70,7 @@ impl<T: Tag> Hash<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a new engine.
|
/// Constructs a new engine.
|
||||||
pub fn engine() -> HashEngine { T::engine() }
|
pub fn engine() -> HashEngine { <(T,)>::engine() }
|
||||||
|
|
||||||
/// Produces a hash from the current state of a given engine.
|
/// Produces a hash from the current state of a given engine.
|
||||||
pub fn from_engine(e: HashEngine) -> Hash<T> { from_engine(e) }
|
pub fn from_engine(e: HashEngine) -> Hash<T> { from_engine(e) }
|
||||||
|
@ -135,7 +151,10 @@ impl<T: Tag> core::hash::Hash for Hash<T> {
|
||||||
|
|
||||||
crate::internal_macros::hash_trait_impls!(256, false, T: Tag);
|
crate::internal_macros::hash_trait_impls!(256, false, T: Tag);
|
||||||
|
|
||||||
fn from_engine<T: Tag>(e: sha256::HashEngine) -> Hash<T> {
|
fn from_engine<T>(e: sha256::HashEngine) -> Hash<T>
|
||||||
|
where
|
||||||
|
(T,): Tag,
|
||||||
|
{
|
||||||
Hash::from_byte_array(sha256::Hash::from_engine(e).to_byte_array())
|
Hash::from_byte_array(sha256::Hash::from_engine(e).to_byte_array())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue