Skip to main content

json_string_eq

Function json_string_eq 

Source
pub fn json_string_eq(value: &[u8], literal: &[u8]) -> bool
Expand description

Compare a JSON-encoded value byte-slice against a plain literal.

  • If value is a JSON string ("…"), compares the unquoted body.
  • Otherwise compares the raw bytes (number / bool / null).

Fast path uses memchr::memchr (SIMD-accelerated) to detect escape sequences and short-circuit the comparison. When the body contains no \ byte, we fall through to a direct slice equality which LLVM auto-vectorises to AVX2/SSE on x86_64.