pub struct Digest {
pub algorithm: String,
pub hash: String,
pub size: u64,
}Expand description
Algorithm-tagged digest and exact byte length of a cache object.
Fields§
§algorithm: StringHash algorithm name (blake3 or sha256).
hash: StringLowercase hexadecimal hash value.
size: u64Exact uncompressed object length in bytes.
Implementations§
Source§impl Digest
impl Digest
Sourcepub fn blake3_file(path: &Path) -> Result<Self>
pub fn blake3_file(path: &Path) -> Result<Self>
Hash a file with BLAKE3 while counting bytes in the same pass.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate the algorithm and lowercase hexadecimal representation.
Sourcepub fn matches_bytes(&self, bytes: &[u8]) -> Result<bool>
pub fn matches_bytes(&self, bytes: &[u8]) -> Result<bool>
Return whether bytes have this digest and declared length.
Sourcepub fn matches_file(&self, path: &Path) -> Result<bool>
pub fn matches_file(&self, path: &Path) -> Result<bool>
Stream a file and return whether it has this digest and length.
Sourcepub fn key(&self) -> String
pub fn key(&self) -> String
Stable storage key containing the algorithm, hash, and byte length.
Sourcepub fn algorithm_kind(&self) -> Result<DigestAlgorithm>
pub fn algorithm_kind(&self) -> Result<DigestAlgorithm>
Parse the algorithm tag into its closed version-one enum.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Digest
impl<'de> Deserialize<'de> for Digest
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
impl Eq for Digest
Source§impl Ord for Digest
impl Ord for Digest
1.21.0 (const: unstable) · 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 PartialOrd for Digest
impl PartialOrd for Digest
impl StructuralPartialEq for Digest
Auto Trait Implementations§
impl Freeze for Digest
impl RefUnwindSafe for Digest
impl Send for Digest
impl Sync for Digest
impl Unpin for Digest
impl UnsafeUnpin for Digest
impl UnwindSafe for Digest
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