diff options
author | Florian Klink <flokli@flokli.de> | 2023-07-20T10·37+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-07-21T19·01+0000 |
commit | a6580748aabe7fcbea735396ac700661b6c53e87 (patch) | |
tree | fab2df50c860f6ddc6730693223aa42e0416dca0 /tvix/store/src/proto/mod.rs | |
parent | 72e82ffcb11b1aaf1f1cc8db4189ced5ec0aa42e (diff) |
feat(tvix/store/digests): use bytes::Bytes instead of Vec<u8> r/6437
This will save us some copies, because a clone will simply create an additional pointer to the same data. Change-Id: I017a5d6b4c85a861b5541ebad2858ad4fbf8e8fa Reviewed-on: https://cl.tvl.fyi/c/depot/+/8978 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/store/src/proto/mod.rs')
-rw-r--r-- | tvix/store/src/proto/mod.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tvix/store/src/proto/mod.rs b/tvix/store/src/proto/mod.rs index 7e81efc51782..126a8b0edce3 100644 --- a/tvix/store/src/proto/mod.rs +++ b/tvix/store/src/proto/mod.rs @@ -247,12 +247,11 @@ impl Directory { pub fn digest(&self) -> B3Digest { let mut hasher = blake3::Hasher::new(); - let vec = hasher + hasher .update(&self.encode_to_vec()) .finalize() .as_bytes() - .to_vec(); - B3Digest::from_vec(vec).unwrap() + .into() } /// validate checks the directory for invalid data, such as: |