v_escape_codegen 0.2.0

Code generator package for v_escape
v_escape_codegen-0.2.0 is not a library.

Documentation Latest version

v_escape_codegen

A tool for generating escape functions.

Installation

cargo install v_escape_codegen

Usage

# Create a new crate
mkdir <crate_name>
cd <crate_name>
cargo init --lib

# Write a template to src/_lib.rs
cat <<EOF > src/_lib.rs
new!(
    '<' -> "&lt;",
    '>' -> "&gt;",
    '&' -> "&amp;",
    '"' -> "&quot;",
    '\'' -> "&#x27;",
    '/' -> "&#x2f;"
);
EOF

# Generate the code from the template
v_escape_codegen -i .

Generated crate

Generate a new crate with escape_fmt and escape_string functions.

Features in the generated crate

  • alloc: Enables the alloc library 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.

Documentation

  • Minimum supported Rust version: 1.85.0 or later

License

Licensed under either of

at your option.