pub enum ContentDigest {
Sha1(Vec<u8>),
Sha256(Vec<u8>),
}
Expand description
Represents a content digest.
Variants§
Implementations§
Source§impl ContentDigest
impl ContentDigest
Sourcepub fn sha1_hex(digest: &str) -> Result<Self>
pub fn sha1_hex(digest: &str) -> Result<Self>
Create a new SHA-1 instance by parsing a hex digest.
Sourcepub fn sha256_hex(digest: &str) -> Result<Self>
pub fn sha256_hex(digest: &str) -> Result<Self>
Create a new SHA-256 instance by parsing a hex digest.
Sourcepub fn from_hex_digest(checksum: DigestFlavor, digest: &str) -> Result<Self>
pub fn from_hex_digest(checksum: DigestFlavor, digest: &str) -> Result<Self>
Obtain an instance by parsing a hex string as a [ChecksumType].
Sourcepub fn new_hasher(&self) -> Box<dyn DynDigest + Send>
pub fn new_hasher(&self) -> Box<dyn DynDigest + Send>
Create a new hasher matching for the type of this digest.
Sourcepub fn digest_bytes(&self) -> &[u8] ⓘ
pub fn digest_bytes(&self) -> &[u8] ⓘ
Obtain the digest bytes for this content digest.
Sourcepub fn digest_hex(&self) -> String
pub fn digest_hex(&self) -> String
Obtain the hex encoded content digest.
Sourcepub fn digest_type(&self) -> DigestFlavor
pub fn digest_type(&self) -> DigestFlavor
Obtain the [ChecksumType] for this digest.
Trait Implementations§
Source§impl Clone for ContentDigest
impl Clone for ContentDigest
Source§fn clone(&self) -> ContentDigest
fn clone(&self) -> ContentDigest
Returns a copy 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 ContentDigest
impl Debug for ContentDigest
Source§impl PartialEq for ContentDigest
impl PartialEq for ContentDigest
Source§impl PartialOrd for ContentDigest
impl PartialOrd for ContentDigest
Source§impl TryFrom<Checksum> for ContentDigest
impl TryFrom<Checksum> for ContentDigest
Source§impl TryFrom<Checksum> for ContentDigest
impl TryFrom<Checksum> for ContentDigest
impl Eq for ContentDigest
impl StructuralPartialEq for ContentDigest
Auto Trait Implementations§
impl Freeze for ContentDigest
impl RefUnwindSafe for ContentDigest
impl Send for ContentDigest
impl Sync for ContentDigest
impl Unpin for ContentDigest
impl UnwindSafe for ContentDigest
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