pub struct HashDigest<D = Arc<[u8]>> { /* private fields */ }Expand description
Hash digest.
Implementations§
Source§impl<D> HashDigest<D>
impl<D> HashDigest<D>
Sourcepub fn new(algorithm: HashAlgorithm, raw: D) -> Result<Self, InvalidDigestError>
pub fn new(algorithm: HashAlgorithm, raw: D) -> Result<Self, InvalidDigestError>
Create HashDigest from the provided algorithm and raw digest.
§Errors
Returns an error if the length of the raw digest does not match the expected size for the algorithm.
Sourcepub const fn new_unchecked(algorithm: HashAlgorithm, raw: D) -> Self
pub const fn new_unchecked(algorithm: HashAlgorithm, raw: D) -> Self
Create HashDigest from the provided algorithm and raw digest without checking
the digest’s length.
Sourcepub const fn algorithm(&self) -> HashAlgorithm
pub const fn algorithm(&self) -> HashAlgorithm
Algorithm used to compute the digest.
Sourcepub fn raw_hex_string(&self) -> String
pub fn raw_hex_string(&self) -> String
Convert the raw digest to a hex string.
Sourcepub fn into_inner(self) -> D
pub fn into_inner(self) -> D
Convert the digest back to its raw representation.
Trait Implementations§
Source§impl<D> AsRef<[u8]> for HashDigest<D>
impl<D> AsRef<[u8]> for HashDigest<D>
Source§impl<D: Clone> Clone for HashDigest<D>
impl<D: Clone> Clone for HashDigest<D>
Source§fn clone(&self) -> HashDigest<D>
fn clone(&self) -> HashDigest<D>
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<D: Debug> Debug for HashDigest<D>
impl<D: Debug> Debug for HashDigest<D>
Source§impl<'de, Data: From<Vec<u8>>> Deserialize<'de> for HashDigest<Data>
Available on crate feature serde only.
impl<'de, Data: From<Vec<u8>>> Deserialize<'de> for HashDigest<Data>
Available on crate feature
serde only.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<D> Display for HashDigest<D>
impl<D> Display for HashDigest<D>
Source§impl<D: Hash> Hash for HashDigest<D>
impl<D: Hash> Hash for HashDigest<D>
Source§impl<D: Ord> Ord for HashDigest<D>
impl<D: Ord> Ord for HashDigest<D>
Source§fn cmp(&self, other: &HashDigest<D>) -> Ordering
fn cmp(&self, other: &HashDigest<D>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<D: PartialEq> PartialEq for HashDigest<D>
impl<D: PartialEq> PartialEq for HashDigest<D>
Source§impl<D: PartialOrd> PartialOrd for HashDigest<D>
impl<D: PartialOrd> PartialOrd for HashDigest<D>
impl<D: Eq> Eq for HashDigest<D>
impl<D> StructuralPartialEq for HashDigest<D>
Auto Trait Implementations§
impl<D> Freeze for HashDigest<D>where
D: Freeze,
impl<D> RefUnwindSafe for HashDigest<D>where
D: RefUnwindSafe,
impl<D> Send for HashDigest<D>where
D: Send,
impl<D> Sync for HashDigest<D>where
D: Sync,
impl<D> Unpin for HashDigest<D>where
D: Unpin,
impl<D> UnwindSafe for HashDigest<D>where
D: 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
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)