diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/src/lib.rs | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/common/src/lib.rs b/common/src/lib.rs index 0a538a5..c26150d 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs | |||
@@ -254,27 +254,6 @@ impl<B: AsRef<[u8]>> fmt::Display for HexFmt<B> { | |||
254 | } | 254 | } |
255 | } | 255 | } |
256 | 256 | ||
257 | pub struct EscJsonFmt<'a>(pub &'a str); | ||
258 | |||
259 | impl<'a> fmt::Display for EscJsonFmt<'a> { | ||
260 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
261 | let EscJsonFmt(buf) = self; | ||
262 | for c in buf.chars() { | ||
263 | match c { | ||
264 | '"' => f.write_str("\\\"")?, // quote | ||
265 | '\\' => f.write_str("\\\\")?, // backslash | ||
266 | '\x08' => f.write_str("\\b")?, // backspace | ||
267 | '\x0C' => f.write_str("\\f")?, // form feed | ||
268 | '\n' => f.write_str("\\n")?, // line feed | ||
269 | '\r' => f.write_str("\\r")?, // carriage return | ||
270 | '\t' => f.write_str("\\t")?, // horizontal tab | ||
271 | _ => f.write_char(c)?, | ||
272 | }; | ||
273 | } | ||
274 | Ok(()) | ||
275 | } | ||
276 | } | ||
277 | |||
278 | #[derive(Debug, Copy, Clone)] | 257 | #[derive(Debug, Copy, Clone)] |
279 | pub struct Digest<const N: usize> { | 258 | pub struct Digest<const N: usize> { |
280 | inner: [u8; N], | 259 | inner: [u8; N], |