[][src]Macro format_xml::escape

macro_rules! escape {
    ($e:expr) => { ... };
    ({$e:expr}) => { ... };
    ($($tt:tt)*) => { ... };
}

Formats the arguments while escaping &<>"' with their equivalent entities.

Accepts either an expression or a list of literals and formatting instructions.

Examples

use format_xml::escape;
assert_eq!(escape!({"Friday"} "'s the " {13} "th").to_string(), "Friday&apos;s the 13th");
assert_eq!(escape!("<script>alert(" {42;#x} ")</script>").to_string(), "&lt;script&gt;alert(0x2a)&lt;/script&gt;");