(c: u8)
| 58 | |
| 59 | #[inline(always)] |
| 60 | fn json_escaped_char(c: u8) -> Option<&'static str> { |
| 61 | let bitset_value = NEEDS_ESCAPING_BITSET[(c / 64) as usize] & (1 << (c % 64)); |
| 62 | if bitset_value == 0 { |
| 63 | None |
| 64 | } else { |
| 65 | Some(match c { |
| 66 | x if x < 0x20 => ESCAPE_CHARS[c as usize], |
| 67 | b'\\' => "\\\\", |
| 68 | b'\"' => "\\\"", |
| 69 | 0x7F => "\\u007f", |
| 70 | _ => unreachable!(), |
| 71 | }) |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | pub fn write_json_string<W: io::Write>(s: &str, ascii_only: bool, w: &mut W) -> io::Result<()> { |
| 76 | w.write_all(b"\"")?; |
no test coverage detected