about summary refs log tree commit diff
path: root/tvix/nix-compat/src/derivation/string_escape.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-07-29T19·14+0200
committerclbot <clbot@tvl.fyi>2023-07-31T21·41+0000
commit79531c3dab1c24ff3171c0aa067004c8e6c92e3f (patch)
tree6e4198e648810bb835a8b0e0f68bf1af779829a8 /tvix/nix-compat/src/derivation/string_escape.rs
parent9521df708f92a237090b1b17ec969b319c4d00fe (diff)
refactor(tvix/nix-compat): support non-unicode Derivations r/6449
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>
Diffstat (limited to 'tvix/nix-compat/src/derivation/string_escape.rs')
-rw-r--r--tvix/nix-compat/src/derivation/string_escape.rs17
1 files changed, 0 insertions, 17 deletions
diff --git a/tvix/nix-compat/src/derivation/string_escape.rs b/tvix/nix-compat/src/derivation/string_escape.rs
deleted file mode 100644
index 0e1dbe516f73..000000000000
--- a/tvix/nix-compat/src/derivation/string_escape.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-const STRING_ESCAPER: [(char, &str); 5] = [
-    ('\\', "\\\\"),
-    ('\n', "\\n"),
-    ('\r', "\\r"),
-    ('\t', "\\t"),
-    ('\"', "\\\""),
-];
-
-pub fn escape_string(s: &str) -> String {
-    let mut s_replaced = s.to_string();
-
-    for escape_sequence in STRING_ESCAPER {
-        s_replaced = s_replaced.replace(escape_sequence.0, escape_sequence.1);
-    }
-
-    format!("\"{}\"", s_replaced)
-}