Escape HTML in std::write! benchmark

cc #22
This commit is contained in:
Kogia-sima 2020-07-09 23:43:33 +09:00
parent 6ab65f4247
commit f1ad6f3bd3
3 changed files with 5 additions and 2 deletions

1
benches/Cargo.lock generated
View File

@ -207,6 +207,7 @@ dependencies = [
"serde_json",
"serde_yaml",
"tera",
"v_htmlescape",
"yarte",
]

View File

@ -23,6 +23,7 @@ serde_derive = "1"
serde_json = "1"
serde_yaml = "0.8"
tera = { git = "https://github.com/Keats/tera" }
v_htmlescape = "0.9.1"
yarte = { git = "https://github.com/botika/yarte", features = ["bytes-buf", "fixed"] }
[build-dependencies]

View File

@ -1,4 +1,5 @@
use std::io::Write;
use v_htmlescape::escape;
use criterion;
@ -68,8 +69,8 @@ pub fn teams(b: &mut criterion::Bencher<'_>, _: &usize) {
&mut output,
"<li class=\"{champion}\">
<b>{name}</b>: {score}",
champion = champion,
name = team.name,
champion = escape(champion),
name = escape(&team.name),
score = team.score
)
.unwrap();