Skip to main content

escape_text

Function escape_text 

Source
pub fn escape_text(text: &str) -> String
Expand description

text as a text report shows it: a backslash as \\, a newline as \n, a tab as \t, a carriage return as \r, every other control character, U+0000 through U+001F and U+007F through U+009F, and the separators U+2028 and U+2029 as \u{, the code in lowercase hexadecimal without leading zeros, and }, as char::escape_unicode writes it, and every other character as it is.

So no string breaks its line, and since the backslash is escaped too, each escape reads one way and two different strings never give the same text.