diff options
author | Florian Klink <flokli@flokli.de> | 2023-01-31T13·45+0100 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-01-31T15·16+0000 |
commit | 2d24c5f260945216ca01371d4120f5d53f08b2cd (patch) | |
tree | 5053bbffefd5a41241ab6ea27fafc290e44e665f /tvix/derivation/src/string_escape.rs | |
parent | 9e809e21ccb1768567fc2516c5526ad0cdd56df0 (diff) |
refactor(tvix/nix-compat): absorb //tvix/derivation r/5791
Put this in its src/derivation. Change-Id: Ic047ab1c2da555a833ee454e10ef60c77537b617 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7967 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/derivation/src/string_escape.rs')
-rw-r--r-- | tvix/derivation/src/string_escape.rs | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/tvix/derivation/src/string_escape.rs b/tvix/derivation/src/string_escape.rs deleted file mode 100644 index 0e1dbe516f73..000000000000 --- a/tvix/derivation/src/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) -} |