refactor(nix-compat/nixhash): absorb to_plain_hex_string
This is only used inside NixHash::to_nix_hex_string(). Change-Id: I7c9c0cd7d4feaa41b0861bb5c0e99a47ec0caac1 Reviewed-on: https://cl.snix.dev/c/snix/+/30555 Autosubmit: Florian Klink <flokli@flokli.de> Tested-by: besadii Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com>
This commit is contained in:
parent
7b6b94c5ca
commit
87d80eb1cc
1 changed files with 5 additions and 6 deletions
|
|
@ -93,7 +93,11 @@ impl NixHash {
|
|||
/// Formats a [NixHash] in the Nix default hash format,
|
||||
/// which is the algo, followed by a colon, then the lower hex encoded digest.
|
||||
pub fn to_nix_hex_string(&self) -> String {
|
||||
format!("{}:{}", self.algo(), self.to_plain_hex_string())
|
||||
format!(
|
||||
"{}:{}",
|
||||
self.algo(),
|
||||
HEXLOWER.encode(self.digest_as_bytes())
|
||||
)
|
||||
}
|
||||
|
||||
/// Formats a [NixHash] in the format that's used inside CAHash,
|
||||
|
|
@ -123,11 +127,6 @@ impl NixHash {
|
|||
|
||||
s
|
||||
}
|
||||
|
||||
/// Returns the digest as a hex string -- without any algorithm prefix.
|
||||
pub fn to_plain_hex_string(&self) -> String {
|
||||
HEXLOWER.encode(self.digest_as_bytes())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for NixHash {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue