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
3
tvix/Cargo.lock
generated
3
tvix/Cargo.lock
generated
|
@ -280,6 +280,7 @@ dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"constant_time_eq",
|
"constant_time_eq",
|
||||||
|
"digest",
|
||||||
"rayon",
|
"rayon",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -649,6 +650,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block-buffer",
|
"block-buffer",
|
||||||
"crypto-common",
|
"crypto-common",
|
||||||
|
"subtle",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -3304,6 +3306,7 @@ dependencies = [
|
||||||
"bstr",
|
"bstr",
|
||||||
"bytes",
|
"bytes",
|
||||||
"data-encoding",
|
"data-encoding",
|
||||||
|
"digest",
|
||||||
"fuse-backend-rs",
|
"fuse-backend-rs",
|
||||||
"futures",
|
"futures",
|
||||||
"hex-literal",
|
"hex-literal",
|
||||||
|
|
|
@ -922,6 +922,12 @@ rec {
|
||||||
name = "constant_time_eq";
|
name = "constant_time_eq";
|
||||||
packageId = "constant_time_eq";
|
packageId = "constant_time_eq";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
name = "digest";
|
||||||
|
packageId = "digest";
|
||||||
|
optional = true;
|
||||||
|
features = [ "mac" ];
|
||||||
|
}
|
||||||
{
|
{
|
||||||
name = "rayon";
|
name = "rayon";
|
||||||
packageId = "rayon";
|
packageId = "rayon";
|
||||||
|
@ -943,7 +949,7 @@ rec {
|
||||||
"traits-preview" = [ "digest" ];
|
"traits-preview" = [ "digest" ];
|
||||||
"zeroize" = [ "dep:zeroize" "arrayvec/zeroize" ];
|
"zeroize" = [ "dep:zeroize" "arrayvec/zeroize" ];
|
||||||
};
|
};
|
||||||
resolvedDefaultFeatures = [ "default" "rayon" "std" ];
|
resolvedDefaultFeatures = [ "default" "digest" "rayon" "std" "traits-preview" ];
|
||||||
};
|
};
|
||||||
"block-buffer" = rec {
|
"block-buffer" = rec {
|
||||||
crateName = "block-buffer";
|
crateName = "block-buffer";
|
||||||
|
@ -1917,6 +1923,12 @@ rec {
|
||||||
name = "crypto-common";
|
name = "crypto-common";
|
||||||
packageId = "crypto-common";
|
packageId = "crypto-common";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
name = "subtle";
|
||||||
|
packageId = "subtle";
|
||||||
|
optional = true;
|
||||||
|
usesDefaultFeatures = false;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
features = {
|
features = {
|
||||||
"blobby" = [ "dep:blobby" ];
|
"blobby" = [ "dep:blobby" ];
|
||||||
|
@ -1931,7 +1943,7 @@ rec {
|
||||||
"std" = [ "alloc" "crypto-common/std" ];
|
"std" = [ "alloc" "crypto-common/std" ];
|
||||||
"subtle" = [ "dep:subtle" ];
|
"subtle" = [ "dep:subtle" ];
|
||||||
};
|
};
|
||||||
resolvedDefaultFeatures = [ "alloc" "block-buffer" "core-api" "default" "std" ];
|
resolvedDefaultFeatures = [ "alloc" "block-buffer" "core-api" "default" "mac" "std" "subtle" ];
|
||||||
};
|
};
|
||||||
"dirs" = rec {
|
"dirs" = rec {
|
||||||
crateName = "dirs";
|
crateName = "dirs";
|
||||||
|
@ -10288,7 +10300,7 @@ rec {
|
||||||
{
|
{
|
||||||
name = "blake3";
|
name = "blake3";
|
||||||
packageId = "blake3";
|
packageId = "blake3";
|
||||||
features = [ "rayon" "std" ];
|
features = [ "rayon" "std" "traits-preview" ];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "bstr";
|
name = "bstr";
|
||||||
|
@ -10302,6 +10314,10 @@ rec {
|
||||||
name = "data-encoding";
|
name = "data-encoding";
|
||||||
packageId = "data-encoding";
|
packageId = "data-encoding";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
name = "digest";
|
||||||
|
packageId = "digest";
|
||||||
|
}
|
||||||
{
|
{
|
||||||
name = "fuse-backend-rs";
|
name = "fuse-backend-rs";
|
||||||
packageId = "fuse-backend-rs";
|
packageId = "fuse-backend-rs";
|
||||||
|
|
|
@ -5,9 +5,12 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-stream = "0.3.5"
|
async-stream = "0.3.5"
|
||||||
blake3 = { version = "1.3.1", features = ["rayon", "std"] }
|
async-tempfile = "0.4.0"
|
||||||
|
blake3 = { version = "1.3.1", features = ["rayon", "std", "traits-preview"] }
|
||||||
|
bstr = "1.6.0"
|
||||||
bytes = "1.4.0"
|
bytes = "1.4.0"
|
||||||
data-encoding = "2.3.3"
|
data-encoding = "2.3.3"
|
||||||
|
digest = "0.10.7"
|
||||||
futures = "0.3.30"
|
futures = "0.3.30"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
parking_lot = "0.12.1"
|
parking_lot = "0.12.1"
|
||||||
|
@ -23,8 +26,6 @@ tower = "0.4.13"
|
||||||
tracing = "0.1.37"
|
tracing = "0.1.37"
|
||||||
url = "2.4.0"
|
url = "2.4.0"
|
||||||
walkdir = "2.4.0"
|
walkdir = "2.4.0"
|
||||||
bstr = "1.6.0"
|
|
||||||
async-tempfile = "0.4.0"
|
|
||||||
|
|
||||||
[dependencies.fuse-backend-rs]
|
[dependencies.fuse-backend-rs]
|
||||||
optional = true
|
optional = true
|
||||||
|
|
|
@ -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 {
|
impl TryFrom<Vec<u8>> for B3Digest {
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue