Skip to main content

Crate v_escape

Crate v_escape 

Source
Expand description

§Documentation Latest version

§v_escape

This crate provides a procedural macro for generating escape functions.

§Example

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

  • Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Macros§

escape
Generate escape functions from a list of character mappings.
escape_builder
A macro for creating a escape functions

Traits§

Escapes
A trait that abstracts masking functions for escape sequences.
EscapesBuilder
A builder trait for creating instances of types that implement the Escapes trait.
Vector
A trait for describing vector operations used by vectorized searchers.