mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-23 14:08:06 +00:00
Follow rust std: The old io module is now called old_io
This commit is contained in:
+4
-4
@@ -1,6 +1,6 @@
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use std::old_io;
|
||||
|
||||
use de::{Token, TokenKind};
|
||||
|
||||
@@ -82,7 +82,7 @@ impl fmt::Debug for ErrorCode {
|
||||
pub enum Error {
|
||||
/// msg, line, col
|
||||
SyntaxError(ErrorCode, usize, usize),
|
||||
IoError(io::IoError),
|
||||
IoError(old_io::IoError),
|
||||
ExpectedError(String, String),
|
||||
MissingFieldError(String),
|
||||
UnknownVariantError(String),
|
||||
@@ -118,8 +118,8 @@ impl error::Error for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl error::FromError<io::IoError> for Error {
|
||||
fn from_error(error: io::IoError) -> Error {
|
||||
impl error::FromError<old_io::IoError> for Error {
|
||||
fn from_error(error: old_io::IoError) -> Error {
|
||||
Error::IoError(error)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -65,7 +65,7 @@ To serialize using `Serialize`:
|
||||
extern crate serde_macros;
|
||||
extern crate serde;
|
||||
|
||||
use std::io::ByRefWriter;
|
||||
use std::old_io::ByRefWriter;
|
||||
use serde::json;
|
||||
use serde::Serialize;
|
||||
|
||||
@@ -319,7 +319,7 @@ pub mod error;
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::fmt::Debug;
|
||||
use std::io;
|
||||
use std::old_io;
|
||||
use std::str;
|
||||
use std::string;
|
||||
use std::collections::BTreeMap;
|
||||
@@ -425,7 +425,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn test_encode_ok<
|
||||
T: PartialEq + Debug + ToJson + ser::Serialize<super::Serializer<Vec<u8>>, io::IoError>
|
||||
T: PartialEq + Debug + ToJson + ser::Serialize<super::Serializer<Vec<u8>>, old_io::IoError>
|
||||
>(errors: &[(T, &str)]) {
|
||||
for &(ref value, out) in errors.iter() {
|
||||
let out = out.to_string();
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
use std::f32;
|
||||
use std::f64;
|
||||
use std::num::{Float, FpCategory};
|
||||
use std::io::{IoError, IoResult};
|
||||
use std::old_io::{IoError, IoResult};
|
||||
use std::string::FromUtf8Error;
|
||||
|
||||
use ser::Serialize;
|
||||
@@ -25,7 +25,7 @@ fn escape_bytes<W: Writer>(wr: &mut W, bytes: &[u8]) -> IoResult<()> {
|
||||
};
|
||||
|
||||
if start < i {
|
||||
try!(wr.write(&bytes[start..i]));
|
||||
try!(wr.write_all(&bytes[start..i]));
|
||||
}
|
||||
|
||||
try!(wr.write_str(escaped));
|
||||
@@ -34,7 +34,7 @@ fn escape_bytes<W: Writer>(wr: &mut W, bytes: &[u8]) -> IoResult<()> {
|
||||
}
|
||||
|
||||
if start != bytes.len() {
|
||||
try!(wr.write(&bytes[start..]));
|
||||
try!(wr.write_all(&bytes[start..]));
|
||||
}
|
||||
|
||||
wr.write_str("\"")
|
||||
@@ -69,12 +69,12 @@ fn spaces<W: Writer>(wr: &mut W, mut n: usize) -> IoResult<()> {
|
||||
const BUF: &'static [u8; LEN] = &[b' '; LEN];
|
||||
|
||||
while n >= LEN {
|
||||
try!(wr.write(BUF));
|
||||
try!(wr.write_all(BUF));
|
||||
n -= LEN;
|
||||
}
|
||||
|
||||
if n > 0 {
|
||||
wr.write(&BUF[..n])
|
||||
wr.write_all(&BUF[..n])
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
use std::collections::{HashMap, BTreeMap, btree_map};
|
||||
use std::fmt;
|
||||
use std::io::{ByRefWriter, IoResult};
|
||||
use std::io;
|
||||
use std::old_io::{ByRefWriter, IoResult};
|
||||
use std::old_io;
|
||||
use std::str;
|
||||
use std::string::ToString;
|
||||
use std::vec;
|
||||
@@ -221,8 +221,8 @@ struct WriterFormatter<'a, 'b: 'a> {
|
||||
}
|
||||
|
||||
impl<'a, 'b> Writer for WriterFormatter<'a, 'b> {
|
||||
fn write(&mut self, buf: &[u8]) -> IoResult<()> {
|
||||
self.inner.write_str(str::from_utf8(buf).unwrap()).map_err(|_| io::IoError::last_error())
|
||||
fn write_all(&mut self, buf: &[u8]) -> IoResult<()> {
|
||||
self.inner.write_str(str::from_utf8(buf).unwrap()).map_err(|_| old_io::IoError::last_error())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user