pub struct Sha256Hash(/* private fields */);Expand description
SHA-256 hash digest (32 bytes)
Fixed-size hash with compile-time size guarantees. Serializes as base64, deserializes from either hex (64 chars) or base64.
Implementations§
Source§impl Sha256Hash
impl Sha256Hash
pub fn from_bytes(bytes: [u8; 32]) -> Self
pub fn try_from_slice(bytes: &[u8]) -> Result<Self>
pub fn from_hex(hex_str: &str) -> Result<Self>
pub fn from_base64(s: &str) -> Result<Self>
Sourcepub fn from_hex_or_base64(s: &str) -> Result<Self>
pub fn from_hex_or_base64(s: &str) -> Result<Self>
Parse from hex or base64 string (auto-detect format)
pub fn to_hex(&self) -> String
pub fn to_base64(&self) -> String
pub fn as_bytes(&self) -> &[u8; 32]
pub fn as_slice(&self) -> &[u8] ⓘ
Trait Implementations§
Source§impl AsRef<[u8]> for Sha256Hash
impl AsRef<[u8]> for Sha256Hash
Source§impl Clone for Sha256Hash
impl Clone for Sha256Hash
Source§fn clone(&self) -> Sha256Hash
fn clone(&self) -> Sha256Hash
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Sha256Hash
impl Debug for Sha256Hash
Source§impl<'de> Deserialize<'de> for Sha256Hash
impl<'de> Deserialize<'de> for Sha256Hash
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 From<Sha256Hash> for Artifact<'static>
impl From<Sha256Hash> for Artifact<'static>
Source§fn from(hash: Sha256Hash) -> Self
fn from(hash: Sha256Hash) -> Self
Converts to this type from the input type.
Source§impl Hash for Sha256Hash
impl Hash for Sha256Hash
Source§impl PartialEq for Sha256Hash
impl PartialEq for Sha256Hash
Source§impl Serialize for Sha256Hash
impl Serialize for Sha256Hash
impl Copy for Sha256Hash
impl Eq for Sha256Hash
impl StructuralPartialEq for Sha256Hash
Auto Trait Implementations§
impl Freeze for Sha256Hash
impl RefUnwindSafe for Sha256Hash
impl Send for Sha256Hash
impl Sync for Sha256Hash
impl Unpin for Sha256Hash
impl UnsafeUnpin for Sha256Hash
impl UnwindSafe for Sha256Hash
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Upper case
letters are used (e.g. F9B4CA)