Skip to main content

escape_brackets

Function escape_brackets 

Source
pub fn escape_brackets(s: &str) -> Cow<'_, str>
Expand description

Escape every unescaped [ and ] as \[ / \], leaving already-escaped brackets and every other character untouched. The inverse of unescape_brackets. Used to render a field name whose brackets must be read literally (for example below the array-matching spec version), so the escape-aware field resolver does not treat a trailing [...] as a selector. Returns a borrow when there is nothing to escape (the common case).