This commit is contained in:
Mikhail Borisov
2015-05-12 15:03:26 +03:00
parent 875610044f
commit 5fd9daa865
+10 -2
View File
@@ -3,7 +3,6 @@
use std::ops;
use std::fmt;
use std::ascii;
use std::char;
use ser;
use de;
@@ -91,6 +90,15 @@ impl fmt::Debug for ByteBuf {
}
}
/*
// Disabled: triggers conflict with From implementation below
impl Into<Vec<u8>> for ByteBuf {
fn into(self) -> Vec<u8> {
self.bytes
}
}
*/
impl<T> From<T> for ByteBuf where T: Into<Vec<u8>> {
fn from(bytes: T) -> Self {
ByteBuf {
@@ -205,7 +213,7 @@ fn escape_bytestring(bytes: &[u8]) -> String {
let mut result = String::new();
for &b in bytes {
for esc in ascii::escape_default(b) {
result.push(char::from_u32(esc as u32).unwrap());
result.push(esc as char);
}
}
result