pub struct Hash(/* private fields */);Expand description
Content-addressed SHA-256 hash (32 bytes, displayed as lowercase hex).
Implementations§
Source§impl Hash
impl Hash
Sourcepub fn from_bytes(bytes: &[u8; 32]) -> Self
pub fn from_bytes(bytes: &[u8; 32]) -> Self
Create a hash from a fixed-size 32-byte array (compile-time safe).
Sourcepub fn try_from_bytes(bytes: &[u8]) -> Result<Self>
pub fn try_from_bytes(bytes: &[u8]) -> Result<Self>
Create a hash from a variable-length byte slice (fallible).
pub fn from_hex(hex_str: &str) -> Result<Self>
pub fn as_bytes(&self) -> &[u8; 32]
pub fn to_hex(&self) -> String
Trait Implementations§
impl Copy for Hash
Source§impl<'de> Deserialize<'de> for Hash
impl<'de> Deserialize<'de> for Hash
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
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 UnsafeUnpin 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