Enum nix_compat::nixhash::NixHash
source · pub enum NixHash {
Md5([u8; 16]),
Sha1([u8; 20]),
Sha256([u8; 32]),
Sha512(Box<[u8; 64]>),
}
Expand description
NixHash represents hashes known by Nix.
Variants§
Implementations§
source§impl NixHash
impl NixHash
sourcepub fn digest_as_bytes(&self) -> &[u8] ⓘ
pub fn digest_as_bytes(&self) -> &[u8] ⓘ
returns the digest as variable-length byte slice.
sourcepub fn from_nix_hex_str(s: &str) -> Option<Self>
pub fn from_nix_hex_str(s: &str) -> Option<Self>
Constructs a NixHash from the Nix default hash format, the inverse of Self::to_nix_hex_string.
sourcepub fn to_nix_hex_string(&self) -> String
pub fn to_nix_hex_string(&self) -> String
Formats a NixHash in the Nix default hash format, which is the algo, followed by a colon, then the lower hex encoded digest.
sourcepub(crate) fn to_nix_nixbase32_string(&self) -> String
pub(crate) fn to_nix_nixbase32_string(&self) -> String
Formats a NixHash in the format that’s used inside CAHash, which is the algo, followed by a colon, then the nixbase32-encoded digest.
sourcepub fn to_plain_hex_string(&self) -> String
pub fn to_plain_hex_string(&self) -> String
Returns the digest as a hex string – without any algorithm prefix.
Trait Implementations§
source§impl<'de> Deserialize<'de> for NixHash
impl<'de> Deserialize<'de> for NixHash
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 Ord for NixHash
impl Ord for NixHash
Same order as sorting the corresponding nixbase32 strings.
This order is used in the ATerm serialization of a derivation and thus affects the calculated output hash.
source§impl PartialEq for NixHash
impl PartialEq for NixHash
source§impl PartialOrd for NixHash
impl PartialOrd for NixHash
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for NixHash
impl StructuralPartialEq for NixHash
Auto Trait Implementations§
impl Freeze for NixHash
impl RefUnwindSafe for NixHash
impl Send for NixHash
impl Sync for NixHash
impl Unpin for NixHash
impl UnwindSafe for NixHash
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