39 releases

Uses new Rust 2024

0.17.0 Apr 25, 2026
0.15.8 Aug 5, 2022
0.15.7 Jul 27, 2022
0.14.1 Oct 12, 2021
0.3.2 Dec 27, 2018

#139 in Hardware support

Download history 114572/week @ 2026-02-24 128071/week @ 2026-03-03 250928/week @ 2026-03-10 152604/week @ 2026-03-17 154418/week @ 2026-03-24 141498/week @ 2026-03-31 142898/week @ 2026-04-07 154709/week @ 2026-04-14 157064/week @ 2026-04-21 157453/week @ 2026-04-28 157181/week @ 2026-05-05 158468/week @ 2026-05-12 162234/week @ 2026-05-19 155578/week @ 2026-05-26 169666/week @ 2026-06-02 178630/week @ 2026-06-09

691,092 downloads per month
Used in 497 crates (47 directly)

MIT/Apache

69KB
1K SLoC

Documentation Latest version

v_htmlescape

The simd optimized html escape code

Quick start

use v_htmlescape::escape_fmt;

print!("{}", escape_fmt("foo<bar"));

lib.rs:

autogenerated by v_escape_codegen@0.2.1

v_htmlescape

Autogenerated escape crate produced by v_escape_codegen on top of the v_escape-base runtime.

Behavior

Each call rewrites the characters listed in the table below into their replacement string; every other byte of the input is forwarded verbatim. All public entry points take a &str (UTF-8 guaranteed at the type level), so they cannot be used to construct invalid UTF-8.

Escape table

Byte (hex) Source Replacement
0x22 " &quot;
0x26 & &amp;
0x27 ' &#x27;
0x2F / &#x2f;
0x3C < &lt;
0x3E > &gt;

Public API

The following functions are emitted, gated by their respective Cargo features (all enabled by default):

Function Feature Signature
escape_string string fn(&str, &mut String)
escape_bytes bytes fn(&str, &mut Vec<u8>)
escape_fmt fmt fn(&str) -> impl Display + '_

At runtime the implementation dispatches to the best SIMD backend available on the current CPU (AVX2/SSE2 on x86_64, NEON on aarch64, simd128 on wasm32) and falls back to a scalar loop otherwise.

Dependencies