pub struct Hash(/* private fields */);
Implementations§
Source§impl Hash
impl Hash
Sourcepub fn digest(bytes: Bytes) -> Self
pub fn digest(bytes: Bytes) -> Self
Enter an array of bytes to get a 32-bit hash. Note: sha3 is used for the time being and may be replaced with other hashing algorithms later.
pub fn from_empty() -> Self
Sourcepub fn from_bytes(bytes: Bytes) -> ProtocolResult<Self>
pub fn from_bytes(bytes: Bytes) -> ProtocolResult<Self>
Converts the byte array to a Hash type.
Note: if you want to compute the hash value of the byte array, you
should call fn digest
.
pub fn from_hex(s: &str) -> ProtocolResult<Self>
pub fn as_bytes(&self) -> Bytes
pub fn as_hex(&self) -> String
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Hash
impl<'de> Deserialize<'de> for Hash
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl FixedCodec for Hash
impl FixedCodec for Hash
fn encode_fixed(&self) -> ProtocolResult<Bytes>
fn decode_fixed(bytes: Bytes) -> ProtocolResult<Self>
Source§impl From<Hash> for MerkleRoot
impl From<Hash> for MerkleRoot
Source§fn from(root: MerkleRoot) -> MerkleRoot
fn from(root: MerkleRoot) -> MerkleRoot
Converts to this type from the input type.
Source§impl Ord for Hash
impl Ord for Hash
Source§impl PartialOrd for Hash
impl PartialOrd for Hash
impl Eq for Hash
impl StructuralPartialEq for Hash
Auto Trait Implementations§
impl Freeze for Hash
impl RefUnwindSafe for Hash
impl Send for Hash
impl Sync for Hash
impl Unpin for Hash
impl UnwindSafe for Hash
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