surrealpatch/lib/src/key/debug.rs

14 lines
373 B
Rust
Raw Normal View History

use crate::kvs::Key;
/// Helpers for debugging keys
/// sprint_key converts a key to an escaped string.
/// This is used for logging and debugging tests and should not be used in implementation code.
pub fn sprint_key(key: &Key) -> String {
key.clone()
.iter()
.flat_map(|&byte| std::ascii::escape_default(byte))
.map(|byte| byte as char)
.collect::<String>()
}