Skip to main content

Crate v_jsonescape

Crate v_jsonescape 

Source
Expand description

autogenerated by v_escape_codegen@0.2.1

§v_jsonescape

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)SourceReplacement
0x00<0x00>\u0000
0x01<0x01>\u0001
0x02<0x02>\u0002
0x03<0x03>\u0003
0x04<0x04>\u0004
0x05<0x05>\u0005
0x06<0x06>\u0006
0x07<0x07>\u0007
0x08<0x08>\b
0x09<0x09>\t
0x0A<0x0A>\n
0x0B<0x0B>\u000b
0x0C<0x0C>\f
0x0D<0x0D>\r
0x0E<0x0E>\u000e
0x0F<0x0F>\u000f
0x10<0x10>\u0010
0x11<0x11>\u0011
0x12<0x12>\u0012
0x13<0x13>\u0013
0x14<0x14>\u0014
0x15<0x15>\u0015
0x16<0x16>\u0016
0x17<0x17>\u0017
0x18<0x18>\u0018
0x19<0x19>\u0019
0x1A<0x1A>\u001a
0x1B<0x1B>\u001b
0x1C<0x1C>\u001c
0x1D<0x1D>\u001d
0x1E<0x1E>\u001e
0x1F<0x1F>\u001f
0x22"\"
0x5C\\\

§Public API

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

FunctionFeatureSignature
escape_stringstringfn(&str, &mut String)
escape_bytesbytesfn(&str, &mut Vec<u8>)
escape_fmtfmtfn(&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.

Functions§

escape_bytes
escape_fmt
escape_string