[−][src]Macro v_escape::new_escape
Generates struct $name
with escaping functionality at fmt
It will get as input:
-
$name: Name of escape class.
-
$pairs: Pairs of
[character]->[quote] || [character]->[quote]
or[character]->[quote]
. -
$t: Optional boolean parameters (simd, avx, sse, print).
- simd: If true (by default), simd optimizations are enabled. When false,
no matter value of avx,
sse4.2
will be used, - avx: If true (by default), avx optimization are enabled. When false,
sse2
(ifranges=true
andsimd=true
) orscalar
(ifsimd=false
) will be used. - ranges: If true (by default), ranges optimizations are enabled. When false,
sse4.2
(ifsimd=true
) orscalar
(ifsimd=false
) will be used. - print: If true (false by default), prints out generated code to console.
- simd: If true (by default), simd optimizations are enabled. When false,
no matter value of avx,
and will:
-
Import
std::fmt::{self, Display, Formatter}
-
Define basic struct with attribute
bytes
andEscape
derive functionality -
Implements for
$name
constructorsnew
andFrom<&'a str>
-
Implements trait
Display
for$name
with escape functionality -
Implements function
escape(&str) -> $name
Example
#[macro_use] extern crate v_escape; new_escape!(MyEscape, "o->bar"); assert_eq!(escape("foobar").to_string(), "fbarbarbar");