MCPcopy Create free account
hub / github.com/pydantic/jiter / decode_array

Method decode_array

crates/jiter/src/string_decoder.rs:254–274  ·  view source on GitHub ↗
(
        data: [u8; T],
        index: &mut usize,
        ascii_only: bool,
    )

Source from the content-addressed store, hash-verified

252 #[inline(always)]
253 #[allow(dead_code)]
254 pub fn decode_array<const T: usize>(
255 data: [u8; T],
256 index: &mut usize,
257 ascii_only: bool,
258 ) -> Option<JsonResult<(Self, bool, usize)>> {
259 for u8_char in data {
260 if !JSON_ASCII[u8_char as usize] {
261 return match &CHAR_TYPE[u8_char as usize] {
262 CharType::Quote => Some(Ok((Self::StringEnd, ascii_only, *index))),
263 CharType::Backslash => Some(Ok((Self::Backslash, ascii_only, *index))),
264 CharType::ControlChar => Some(json_err!(ControlCharacterWhileParsingString, *index)),
265 CharType::Other => {
266 *index += 1;
267 None
268 }
269 };
270 }
271 *index += 1;
272 }
273 unreachable!("error decoding SIMD string chunk")
274 }
275}
276
277// taken serde-rs/json but altered

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected