diff --git a/serde2/src/json/ser.rs b/serde2/src/json/ser.rs index dae76117..52895fe3 100644 --- a/serde2/src/json/ser.rs +++ b/serde2/src/json/ser.rs @@ -1,7 +1,7 @@ use std::f64; use std::io::{mod, ByRefWriter, IoError}; use std::num::{Float, FpCategory}; -use std::str::Utf8Error; +use std::string::FromUtf8Error; use ser; use ser::Serializer; @@ -252,7 +252,7 @@ pub fn to_vec< #[inline] pub fn to_string< T: ser::Serialize, ->(value: &T) -> Result, Utf8Error)>, IoError> { +>(value: &T) -> Result, IoError> { let vec = try!(to_vec(value)); Ok(String::from_utf8(vec)) } diff --git a/src/json/ser.rs b/src/json/ser.rs index c5d56693..2478c813 100644 --- a/src/json/ser.rs +++ b/src/json/ser.rs @@ -2,7 +2,7 @@ use std::f32; use std::f64; use std::num::{Float, FpCategory}; use std::io::{IoError, IoResult}; -use std::str::Utf8Error; +use std::string::FromUtf8Error; use ser::Serialize; use ser; @@ -600,7 +600,7 @@ pub fn to_vec< #[inline] pub fn to_string< T: Serialize>, IoError> ->(value: &T) -> Result, Utf8Error)> { +>(value: &T) -> Result { let buf = to_vec(value); String::from_utf8(buf) } @@ -629,7 +629,7 @@ pub fn to_pretty_vec< /// Encode the specified struct into a json `String` buffer. pub fn to_pretty_string< T: Serialize>, IoError> ->(value: &T) -> Result, Utf8Error)> { +>(value: &T) -> Result { let buf = to_pretty_vec(value); String::from_utf8(buf) }