From 5fd9daa86526139a25abb7ac328bae14032bdf44 Mon Sep 17 00:00:00 2001 From: Mikhail Borisov Date: Tue, 12 May 2015 15:03:26 +0300 Subject: [PATCH] WIP --- src/bytes.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/bytes.rs b/src/bytes.rs index 9e5a9a7d..5a6afa71 100644 --- a/src/bytes.rs +++ b/src/bytes.rs @@ -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> for ByteBuf { + fn into(self) -> Vec { + self.bytes + } +} +*/ + impl From for ByteBuf where T: Into> { 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