#[repr(transparent)]pub struct Hash<T>(/* private fields */)
where
T: Tag;
Expand description
Output of the SHA256t hash function.
Implementations§
source§impl<T> Hash<T>where
T: Tag,
impl<T> Hash<T>where T: Tag,
sourcepub fn from_bytes_ref(bytes: &[u8; 32]) -> &Hash<T>
pub fn from_bytes_ref(bytes: &[u8; 32]) -> &Hash<T>
Zero cost conversion between a fixed length byte array shared reference and a shared reference to this Hash type.
sourcepub fn from_bytes_mut(bytes: &mut [u8; 32]) -> &mut Hash<T>
pub fn from_bytes_mut(bytes: &mut [u8; 32]) -> &mut Hash<T>
Zero cost conversion between a fixed length byte array exclusive reference and an exclusive reference to this Hash type.
Trait Implementations§
source§impl<'de, T> Deserialize<'de> for Hash<T>where
T: Tag,
impl<'de, T> Deserialize<'de> for Hash<T>where T: Tag,
source§fn deserialize<D>(d: D) -> Result<Hash<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(d: D) -> Result<Hash<T>, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T> Hash for Hash<T>where
T: Tag,
impl<T> Hash for Hash<T>where T: Tag,
§type Engine = HashEngine
type Engine = HashEngine
A hashing engine which bytes can be serialized into. It is expected
to implement the
io::Write
trait, and to never return errors under
any conditions.source§const DISPLAY_BACKWARD: bool = true
const DISPLAY_BACKWARD: bool = true
Flag indicating whether user-visible serializations of this hash
should be backward. For some reason Satoshi decided this should be
true for
Sha256dHash
, so here we are.source§fn from_engine(e: HashEngine) -> Hash<T>
fn from_engine(e: HashEngine) -> Hash<T>
Produces a hash from the current state of a given engine.
source§fn from_slice(sl: &[u8]) -> Result<Hash<T>, FromSliceError>
fn from_slice(sl: &[u8]) -> Result<Hash<T>, FromSliceError>
Copies a byte slice into a hash object.
source§fn as_byte_array(&self) -> &<Hash<T> as Hash>::Bytes
fn as_byte_array(&self) -> &<Hash<T> as Hash>::Bytes
Returns a reference to the underlying byte array.
source§fn from_byte_array(bytes: <Hash<T> as Hash>::Bytes) -> Hash<T>
fn from_byte_array(bytes: <Hash<T> as Hash>::Bytes) -> Hash<T>
Constructs a hash from the underlying byte array.
source§fn hash_byte_chunks<B, I>(byte_slices: I) -> Selfwhere
B: AsRef<[u8]>,
I: IntoIterator<Item = B>,
fn hash_byte_chunks<B, I>(byte_slices: I) -> Selfwhere B: AsRef<[u8]>, I: IntoIterator<Item = B>,
Hashes all the byte slices retrieved from the iterator together.
source§impl<T> Ord for Hash<T>where
T: Tag,
impl<T> Ord for Hash<T>where T: Tag,
source§impl<T> PartialEq<Hash<T>> for Hash<T>where
T: Tag,
impl<T> PartialEq<Hash<T>> for Hash<T>where T: Tag,
source§impl<T> PartialOrd<Hash<T>> for Hash<T>where
T: Tag,
impl<T> PartialOrd<Hash<T>> for Hash<T>where T: Tag,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<T> SerdeHash for Hash<T>where
T: Tag,
impl<T> SerdeHash for Hash<T>where T: Tag,
source§fn from_slice_delegated(sl: &[u8]) -> Result<Hash<T>, FromSliceError>
fn from_slice_delegated(sl: &[u8]) -> Result<Hash<T>, FromSliceError>
Helper function to turn a deserialized slice into the correct hash type.
source§fn serialize<S>(
&self,
s: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>( &self, s: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,
Do serde serialization.
source§fn deserialize<'de, D>(d: D) -> Result<Self, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<'de, D>(d: D) -> Result<Self, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
Do serde deserialization.
source§impl<T> Serialize for Hash<T>where
T: Tag,
impl<T> Serialize for Hash<T>where T: Tag,
source§fn serialize<S>(
&self,
s: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>( &self, s: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<T> Copy for Hash<T>where T: Tag,
impl<T> Eq for Hash<T>where T: Tag,
Auto Trait Implementations§
impl<T> RefUnwindSafe for Hash<T>where T: RefUnwindSafe,
impl<T> Send for Hash<T>where T: Send,
impl<T> Sync for Hash<T>where T: Sync,
impl<T> Unpin for Hash<T>where T: Unpin,
impl<T> UnwindSafe for Hash<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more