//! autogenerated by v_escape_codegen@0.2.1
//!
//! # `v_htmlescape`
//!
//! Autogenerated escape crate produced by
//! [`v_escape_codegen`](https://crates.io/crates/v_escape_codegen) on top of the
//! [`v_escape-base`](https://crates.io/crates/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) | Source | Replacement |
//! | ---------- | ------ | ----------- |
//! | `0x22` | `"` | `&quot;` |
//! | `0x26` | `&` | `&amp;` |
//! | `0x27` | `'` | `&#x27;` |
//! | `0x2F` | `/` | `&#x2f;` |
//! | `0x3C` | `<` | `&lt;` |
//! | `0x3E` | `>` | `&gt;` |
//!
//! ## Public API
//!
//! The following functions are emitted, gated by their respective Cargo
//! features (all enabled by default):
//!
//! | Function | Feature | Signature |
//! | -------- | ------- | --------- |
//! | `escape_string` | `string` | `fn(&str, &mut String)` |
//! | `escape_bytes`  | `bytes`  | `fn(&str, &mut Vec<u8>)` |
//! | `escape_fmt`    | `fmt`    | `fn(&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.
//!
static V_ESCAPE_CHARS: [u8; 256] = [
    6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8,
    6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 0u8, 6u8, 6u8, 6u8,
    1u8, 2u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 3u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 6u8, 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UOTES: [&str; 6usize] = ["&quot;", "&amp;", "&#x27;", "&#x2f;", "&lt;", "&gt;"];
const V_ESCAPE_LEN: usize = 6usize;
use v_escape_base::{Escapes, EscapesBuilder, Vector, escape_builder};
#[derive(Debug, Clone, Copy)]
struct Escape<V: Vector> {
    translation_a: V,
    below_a: V,
    translation_b: V,
    below_b: V,
    c: V,
}
#[allow(dead_code)]
struct Builder;
impl EscapesBuilder for Builder {
    type Escapes<V: Vector> = Escape<V>;
    fn new<V: Vector>() -> Self::Escapes<V> {
        Self::Escapes {
            translation_a: V::splat(88i8 as u8),
            below_a: V::splat(121i8 as u8),
            translation_b: V::splat(65i8 as u8),
            below_b: V::splat(124i8 as u8),
            c: V::splat(47i8 as u8),
        }
    }
}
impl<V: Vector> Escapes for Escape<V> {
    const ESCAPE_LEN: usize = 6usize;
    const FALSE_POSITIVE: bool = true;
    type Vector = V;
    #[inline(always)]
    fn masking(&self, vector2: V) -> V {
        vector2
            .add(self.translation_a)
            .gt(self.below_a)
            .or(vector2.add(self.translation_b).gt(self.below_b))
            .or(vector2.cmpeq(self.c))
    }
    #[inline(always)]
    fn escape(i: usize) -> &'static str {
        V_ESCAPE_QUOTES[i]
    }
    #[inline(always)]
    fn position(i: u8) -> usize {
        V_ESCAPE_CHARS[i as usize] as usize
    }
    #[inline(always)]
    fn byte_byte_compare(c: u8) -> bool {
        (V_ESCAPE_CHARS[c as usize] as usize) < V_ESCAPE_LEN
    }
}
escape_builder!(Builder);
