(
data: &[u8],
mut index: usize,
mut ascii_only: bool,
allow_partial: bool,
)
| 222 | impl StringChunk { |
| 223 | #[inline(always)] |
| 224 | pub fn decode_fallback( |
| 225 | data: &[u8], |
| 226 | mut index: usize, |
| 227 | mut ascii_only: bool, |
| 228 | allow_partial: bool, |
| 229 | ) -> JsonResult<(Self, bool, usize)> { |
| 230 | while let Some(next) = data.get(index) { |
| 231 | if !JSON_ASCII[*next as usize] { |
| 232 | match &CHAR_TYPE[*next as usize] { |
| 233 | CharType::Quote => return Ok((Self::StringEnd, ascii_only, index)), |
| 234 | CharType::Backslash => return Ok((Self::Backslash, ascii_only, index)), |
| 235 | CharType::ControlChar => return json_err!(ControlCharacterWhileParsingString, index), |
| 236 | CharType::Other => { |
| 237 | ascii_only = false; |
| 238 | } |
| 239 | } |
| 240 | } |
| 241 | index += 1; |
| 242 | } |
| 243 | if allow_partial { |
| 244 | Ok((Self::StringEnd, ascii_only, index)) |
| 245 | } else { |
| 246 | json_err!(EofWhileParsingString, index) |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | /// decode an array (generally from SIMD) return the result of the chunk, or none if the non-ascii character |
| 251 | /// is just > \x7F (127) |
nothing calls this directly
no outgoing calls
no test coverage detected