serialize crate has moved out of tree to rustc-serialize.

See commit b04bc5cc49
This commit is contained in:
crhino 2014-12-24 12:23:23 -05:00
parent 7e7bd12479
commit 8f982f334e
6 changed files with 20 additions and 15 deletions

View File

@ -9,3 +9,6 @@ keywords = ["binary", "encode", "decode", "serialize", "deserialize"]
license = "MIT" license = "MIT"
description = "A binary serialization / deserialization strategy and implementation." description = "A binary serialization / deserialization strategy and implementation."
[dependencies]
rustc-serialize = "0.1.4"

View File

@ -1,13 +1,13 @@
extern crate bincode; extern crate bincode;
extern crate serialize; extern crate "rustc-serialize" as rustc_serialize;
#[deriving(Encodable, Decodable, PartialEq)] #[deriving(RustcEncodable, RustcDecodable, PartialEq)]
struct Entity { struct Entity {
x: f32, x: f32,
y: f32, y: f32,
} }
#[deriving(Encodable, Decodable, PartialEq)] #[deriving(RustcEncodable, RustcDecodable, PartialEq)]
struct World { struct World {
entities: Vec<Entity> entities: Vec<Entity>
} }

View File

@ -2,15 +2,15 @@
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![crate_type = "dylib"] #![crate_type = "dylib"]
extern crate serialize; extern crate "rustc-serialize" as rustc_serialize;
use std::io::Buffer; use std::io::Buffer;
use std::io::MemWriter; use std::io::MemWriter;
use std::io::MemReader; use std::io::MemReader;
use std::io::IoError; use std::io::IoError;
use std::io::IoResult; use std::io::IoResult;
use serialize::Encodable; use rustc_serialize::Encodable;
use serialize::Decodable; use rustc_serialize::Decodable;
pub use writer::EncoderWriter; pub use writer::EncoderWriter;
pub use reader::DecoderReader; pub use reader::DecoderReader;

View File

@ -1,5 +1,5 @@
use std::io::{Buffer, Reader, IoError, IoResult, OtherIoError}; use std::io::{Buffer, Reader, IoError, IoResult, OtherIoError};
use serialize::Decoder; use rustc_serialize::Decoder;
pub struct DecoderReader<'a, R: 'a> { pub struct DecoderReader<'a, R: 'a> {
reader: &'a mut R reader: &'a mut R

View File

@ -1,10 +1,12 @@
extern crate "rustc-serialize" as serialize;
use std::io::MemWriter; use std::io::MemWriter;
use std::fmt::Show; use std::fmt::Show;
use std::io::MemReader; use std::io::MemReader;
use std::io::IoError; use std::io::IoError;
use std::collections::HashMap; use std::collections::HashMap;
use serialize::{ use rustc_serialize::{
Encoder, Encoder,
Decoder, Decoder,
Encodable, Encodable,
@ -63,7 +65,7 @@ fn test_tuple() {
#[test] #[test]
fn test_basic_struct() { fn test_basic_struct() {
#[deriving(Encodable, Decodable, PartialEq, Show)] #[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)]
struct Easy { struct Easy {
x: int, x: int,
s: String, s: String,
@ -74,13 +76,13 @@ fn test_basic_struct() {
#[test] #[test]
fn test_nested_struct() { fn test_nested_struct() {
#[deriving(Encodable, Decodable, PartialEq, Show)] #[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)]
struct Easy { struct Easy {
x: int, x: int,
s: String, s: String,
y: uint y: uint
} }
#[deriving(Encodable, Decodable, PartialEq, Show)] #[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)]
struct Nest { struct Nest {
f: Easy, f: Easy,
b: uint, b: uint,
@ -96,7 +98,7 @@ fn test_nested_struct() {
#[test] #[test]
fn test_struct_tuple() { fn test_struct_tuple() {
#[deriving(Encodable, Decodable, PartialEq, Show)] #[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)]
struct TubStr(uint, String, f32); struct TubStr(uint, String, f32);
the_same(TubStr(5, "hello".to_string(), 3.2)); the_same(TubStr(5, "hello".to_string(), 3.2));
@ -111,7 +113,7 @@ fn option() {
#[test] #[test]
fn enm() { fn enm() {
#[deriving(Encodable, Decodable, PartialEq, Show)] #[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)]
enum TestEnum { enum TestEnum {
NoArg, NoArg,
OneArg(uint), OneArg(uint),
@ -125,7 +127,7 @@ fn enm() {
#[test] #[test]
fn struct_enum() { fn struct_enum() {
#[deriving(Encodable, Decodable, PartialEq, Show)] #[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)]
enum TestEnum { enum TestEnum {
NoArg, NoArg,
OneArg(uint), OneArg(uint),

View File

@ -1,5 +1,5 @@
use std::io::{Writer, IoError, IoResult}; use std::io::{Writer, IoError, IoResult};
use serialize::Encoder; use rustc_serialize::Encoder;
type EwResult = IoResult<()>; type EwResult = IoResult<()>;