reifydb_core/util/encoding/format/
raw.rs1use std::ascii;
13
14use crate::util::encoding::format::Formatter;
15
16pub struct Raw;
17
18impl Raw {
19 pub fn bytes(bytes: &[u8]) -> String {
20 let escaped = bytes.iter().copied().flat_map(ascii::escape_default).collect::<Vec<_>>();
21 format!("\"{}\"", String::from_utf8_lossy(&escaped))
22 }
23}
24
25impl Formatter for Raw {
26 fn key(key: &[u8]) -> String {
27 Self::bytes(key)
28 }
29
30 fn value(_key: &[u8], value: &[u8]) -> String {
31 Self::bytes(value)
32 }
33}