refactor(tvix/nix-compat): make NixHash an enum with fixed-len bytes

Less Vec<u8> passed around.

Change-Id: Ie153a6bfaa084d7490ffa38634efdf5f3c31a768
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9722
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2023-10-14 17:48:16 +01:00 committed by clbot
parent 786b0324a9
commit 4ae0f428bd
8 changed files with 226 additions and 220 deletions

View file

@ -238,17 +238,16 @@ fn output_path_construction() {
Output {
path: "".to_string(), // will be calculated
hash_with_mode: Some(crate::nixhash::NixHashWithMode::Recursive(
(
crate::nixhash::from_algo_and_digest(
crate::nixhash::HashAlgo::Sha256,
data_encoding::HEXLOWER
&data_encoding::HEXLOWER
.decode(
"08813cbee9903c62be4c5027726a418a300da4500b2d369d3af9286f4815ceba"
.as_bytes(),
)
.unwrap(),
)
.try_into()
.unwrap(),
.unwrap(),
)),
},
);