v_escape 0.19.0

The simd optimized escaping code with macro
Documentation

Documentation Latest version

v_escape

This crate provides a procedural macro for generating escape functions.

Example

# #![cfg(all(feature = "fmt", feature = "string"))]
use v_escape::escape;

escape! {
    b'"' -> """,
    b'<' -> "&lt;"
}

let s = "Hello,< world!\"";
let escaped = escape_fmt(s).to_string();
assert_eq!(escaped, "Hello,&lt; world!&quot;");
let mut escaped = String::with_capacity(s.len());
escape_string(&s, &mut escaped);
assert_eq!(escaped, "Hello,&lt; world!&quot;");

Features

  • fmt: Enables the escape_fmt function.
  • string: Enables the escape_string function.
  • bytes: Enables the escape_bytes function.
  • std: Enables the std library features.
  • alloc: Enables the alloc library features.

Documentation

  • Minimum supported Rust version: 1.85.0 or later

License

Licensed under either of

at your option.