Function tikv_util::escape [−][src]
pub fn escape(data: &[u8]) -> String
A function to escape a byte array to a readable ascii string. escape rules follow golang/protobuf. https://github.com/golang/protobuf/blob/master/proto/text.go#L578
Examples
use tikv_util::escape; assert_eq!(r"ab", escape(b"ab")); assert_eq!(r"a\\023", escape(b"a\\023")); assert_eq!(r"a\000", escape(b"a\0")); assert_eq!("a\\r\\n\\t '\\\"\\\\", escape(b"a\r\n\t '\"\\")); assert_eq!(r"\342\235\244\360\237\220\267", escape("❤🐷".as_bytes()));