refactor(tvix/store/proto): use bstr::ByteSlice

String::from_utf8_lossy simply discards invalid bytes, while bstr
replaces them with their replacement character.

Change-Id: Ib78ff36ca5faacc1ad60bc4ddde7b62773848c07
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10981
Tested-by: BuildkiteCI
Reviewed-by: Peter Kolloch <info@eigenvalue.net>
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Florian Klink 2024-02-20 12:12:37 +07:00 committed by flokli
parent 98a17dbdf9
commit 43570bae11
4 changed files with 8 additions and 1 deletions

View file

@ -1,4 +1,5 @@
#![allow(clippy::derive_partial_eq_without_eq, non_snake_case)]
use bstr::ByteSlice;
use bytes::Bytes;
use data_encoding::BASE64;
// https://github.com/hyperium/tonic/issues/1056
@ -41,7 +42,7 @@ pub enum ValidatePathInfoError {
InvalidRootNode(ValidateNodeError),
/// Invalid node name encountered. Root nodes in PathInfos have more strict name requirements
#[error("Failed to parse {} as StorePath: {1}", String::from_utf8_lossy(.0))]
#[error("Failed to parse {} as StorePath: {1}", .0.to_str_lossy())]
InvalidNodeName(Vec<u8>, store_path::Error),
/// The digest in narinfo.nar_sha256 has an invalid len.