Function schema_ast::string_literal

source ·
pub fn string_literal(s: &str) -> impl Display + '_
Expand description

Transform the input string into a valid (quoted and escaped) PSL string literal.

PSL string literals have the exact same grammar as JSON string literals.

let input = r#"oh
hi"#;
assert_eq!(r#""oh\nhi""#, &string_literal(input).to_string());