Function xml::escape::escape_str [] [src]

pub fn escape_str(s: &str) -> Cow<str>

Performs escaping of common XML characters.

This function replaces several important markup characters with their entity equivalents.

  • <&lt;
  • >&gt;
  • "&quot;
  • '&apos;
  • &&amp;

The resulting string is safe to use inside XML attribute values or in PCDATA sections.

Does not perform allocations if the given string does not contain escapable characters.