I would like to encode Unicode in ASCII using the escape sequences for string literals.
Does the standard library provide some functionality to implement this kind of escaping/unescaping?
fn escape(s: &str) -> String {
unimplemented!()
}
fn unescape(s: &str) -> String {
unimplemented!()
}
fn main() {
let str = "mixed ASCII and 🦀".to_string();
let escaped_str = escape(&str);
assert!(escaped_str.is_ascii());
assert_eq!(str, unescape(&escaped_str));
}