feat(tvix/store): refactor digest conversion
This refactors how the original digest type (Vec<u8>) is converted to [u8; PATH_HASH_SIZE]. Change-Id: I9441470a3a199620fcf328f2b7c890ca6ae93bde Reviewed-on: https://cl.tvl.fyi/c/depot/+/7710 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
parent
58f5ff2c17
commit
60bdf619a3
2 changed files with 2 additions and 6 deletions
|
@ -49,13 +49,9 @@ impl NixPath {
|
|||
|
||||
NixPath::validate_characters(&s[name_offset..])?;
|
||||
|
||||
// copy the digest:Vec<u8> to a [u8; PATH_HASH_SIZE]
|
||||
let mut buffer: [u8; PATH_HASH_SIZE] = [0; PATH_HASH_SIZE];
|
||||
buffer[..PATH_HASH_SIZE].copy_from_slice(&digest[..PATH_HASH_SIZE]);
|
||||
|
||||
Ok(NixPath {
|
||||
name: s[name_offset..].to_string(),
|
||||
digest: buffer,
|
||||
digest: digest.try_into().expect("size is known"),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue