feat(tvix/castore/digests): impl From digest::Output<_> for B3Digest
This allows calling .into() to get a B3Digest. Change-Id: I6e63b496413cd00d84acfcd15c7de0f64c79721f Reviewed-on: https://cl.tvl.fyi/c/depot/+/11086 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
This commit is contained in:
parent
9a7246ea1d
commit
8383e9e02e
4 changed files with 33 additions and 6 deletions
|
|
@ -26,6 +26,13 @@ impl From<B3Digest> for bytes::Bytes {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<digest::Output<blake3::Hasher>> for B3Digest {
|
||||
fn from(value: digest::Output<blake3::Hasher>) -> Self {
|
||||
let v = Into::<[u8; B3_LEN]>::into(value);
|
||||
Self(Bytes::copy_from_slice(&v))
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<Vec<u8>> for B3Digest {
|
||||
type Error = Error;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue