Skip to main content

escape_r_string

Function escape_r_string 

Source
pub fn escape_r_string(s: &str) -> String
Expand description

Escape a Rust &str for embedding inside an R double-quoted string literal.

Handles \, ", newline, carriage return, and tab — the characters R recognises as escape sequences inside "...". Used when formatting MatchArg::CHOICES into the default of a generated R wrapper formal, so that a choice like say "hi" or c:\path cannot produce syntactically invalid R code.