refactor(tvix/nix-compat): support non-unicode Derivations
Derivations can have non-unicode strings in their env values, so the ATerm representations are not necessarily String anymore, but Vec<u8>. Change-Id: Ic23839471eb7f68d9c3c30667c878830946b6607 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8990 Tested-by: BuildkiteCI Reviewed-by: raitobezarius <tvl@lahfa.xyz> Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
parent
9521df708f
commit
79531c3dab
14 changed files with 425 additions and 123 deletions
|
|
@ -37,7 +37,21 @@ impl<P: Clone + Ord + AsRef<[u8]>> ReferenceScanner<P> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Scan the given string for all non-overlapping matches and collect them
|
||||
/// If the given &[u8] is also a valid UTF-8 string, scan for all non-
|
||||
/// overlapping matches and collect them in the scanner.
|
||||
/// TODO: ideally, wu-manber would just work with &[u8] directly.
|
||||
pub fn scan_bytes(&mut self, haystack: &[u8]) {
|
||||
if haystack.len() < STORE_PATH_LEN {
|
||||
return;
|
||||
}
|
||||
|
||||
match std::str::from_utf8(haystack) {
|
||||
Ok(s) => self.scan_str(s),
|
||||
Err(_) => {}
|
||||
}
|
||||
}
|
||||
|
||||
/// Scan the given str for all non-overlapping matches and collect them
|
||||
/// in the scanner.
|
||||
pub fn scan_str(&mut self, haystack: &str) {
|
||||
if haystack.len() < STORE_PATH_LEN {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue