[][src]Macro format_xml::escape

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

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

Accepts an expression or a string template.

Examples

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;");