mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-14 03:31:02 +00:00
Fix: String::from_utf8 became stable and changed signature
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
use std::f64;
|
use std::f64;
|
||||||
use std::io::{mod, ByRefWriter, IoError};
|
use std::io::{mod, ByRefWriter, IoError};
|
||||||
use std::num::{Float, FpCategory};
|
use std::num::{Float, FpCategory};
|
||||||
use std::str::Utf8Error;
|
use std::string::FromUtf8Error;
|
||||||
|
|
||||||
use ser;
|
use ser;
|
||||||
use ser::Serializer;
|
use ser::Serializer;
|
||||||
@@ -252,7 +252,7 @@ pub fn to_vec<
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_string<
|
pub fn to_string<
|
||||||
T: ser::Serialize,
|
T: ser::Serialize,
|
||||||
>(value: &T) -> Result<Result<String, (Vec<u8>, Utf8Error)>, IoError> {
|
>(value: &T) -> Result<Result<String, FromUtf8Error>, IoError> {
|
||||||
let vec = try!(to_vec(value));
|
let vec = try!(to_vec(value));
|
||||||
Ok(String::from_utf8(vec))
|
Ok(String::from_utf8(vec))
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -2,7 +2,7 @@ use std::f32;
|
|||||||
use std::f64;
|
use std::f64;
|
||||||
use std::num::{Float, FpCategory};
|
use std::num::{Float, FpCategory};
|
||||||
use std::io::{IoError, IoResult};
|
use std::io::{IoError, IoResult};
|
||||||
use std::str::Utf8Error;
|
use std::string::FromUtf8Error;
|
||||||
|
|
||||||
use ser::Serialize;
|
use ser::Serialize;
|
||||||
use ser;
|
use ser;
|
||||||
@@ -600,7 +600,7 @@ pub fn to_vec<
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_string<
|
pub fn to_string<
|
||||||
T: Serialize<Serializer<Vec<u8>>, IoError>
|
T: Serialize<Serializer<Vec<u8>>, IoError>
|
||||||
>(value: &T) -> Result<String, (Vec<u8>, Utf8Error)> {
|
>(value: &T) -> Result<String, FromUtf8Error> {
|
||||||
let buf = to_vec(value);
|
let buf = to_vec(value);
|
||||||
String::from_utf8(buf)
|
String::from_utf8(buf)
|
||||||
}
|
}
|
||||||
@@ -629,7 +629,7 @@ pub fn to_pretty_vec<
|
|||||||
/// Encode the specified struct into a json `String` buffer.
|
/// Encode the specified struct into a json `String` buffer.
|
||||||
pub fn to_pretty_string<
|
pub fn to_pretty_string<
|
||||||
T: Serialize<PrettySerializer<Vec<u8>>, IoError>
|
T: Serialize<PrettySerializer<Vec<u8>>, IoError>
|
||||||
>(value: &T) -> Result<String, (Vec<u8>, Utf8Error)> {
|
>(value: &T) -> Result<String, FromUtf8Error> {
|
||||||
let buf = to_pretty_vec(value);
|
let buf = to_pretty_vec(value);
|
||||||
String::from_utf8(buf)
|
String::from_utf8(buf)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user