rust-tags 0.3.1

An HTML templating library for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
pub fn escape_text(text: &str) -> String {
    text
        .chars()
        .map(|c| match c {
            '<'  => format!("&lt;"),
            '>'  => format!("&gt;"),
            '"'  => format!("&quot;"),
            '\'' => format!("&apos;"),
            '&'  => format!("&amp;"),
            _    => format!("{}", c),

        })
        .collect()
}