diff --git a/Cargo.toml b/Cargo.toml index 6aead0f..1dbe653 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,3 +9,6 @@ keywords = ["binary", "encode", "decode", "serialize", "deserialize"] license = "MIT" description = "A binary serialization / deserialization strategy and implementation." + +[dependencies] +rustc-serialize = "0.1.4" diff --git a/examples/basic.rs b/examples/basic.rs index eaf103e..0eaf978 100644 --- a/examples/basic.rs +++ b/examples/basic.rs @@ -1,13 +1,13 @@ extern crate bincode; -extern crate serialize; +extern crate "rustc-serialize" as rustc_serialize; -#[deriving(Encodable, Decodable, PartialEq)] +#[deriving(RustcEncodable, RustcDecodable, PartialEq)] struct Entity { x: f32, y: f32, } -#[deriving(Encodable, Decodable, PartialEq)] +#[deriving(RustcEncodable, RustcDecodable, PartialEq)] struct World { entities: Vec } diff --git a/src/lib.rs b/src/lib.rs index ad60f47..82baa19 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,15 +2,15 @@ #![crate_type = "rlib"] #![crate_type = "dylib"] -extern crate serialize; +extern crate "rustc-serialize" as rustc_serialize; use std::io::Buffer; use std::io::MemWriter; use std::io::MemReader; use std::io::IoError; use std::io::IoResult; -use serialize::Encodable; -use serialize::Decodable; +use rustc_serialize::Encodable; +use rustc_serialize::Decodable; pub use writer::EncoderWriter; pub use reader::DecoderReader; diff --git a/src/reader.rs b/src/reader.rs index b264643..6c04648 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -1,5 +1,5 @@ use std::io::{Buffer, Reader, IoError, IoResult, OtherIoError}; -use serialize::Decoder; +use rustc_serialize::Decoder; pub struct DecoderReader<'a, R: 'a> { reader: &'a mut R diff --git a/src/test.rs b/src/test.rs index b2e3b9a..3485a34 100644 --- a/src/test.rs +++ b/src/test.rs @@ -1,10 +1,12 @@ +extern crate "rustc-serialize" as serialize; + use std::io::MemWriter; use std::fmt::Show; use std::io::MemReader; use std::io::IoError; use std::collections::HashMap; -use serialize::{ +use rustc_serialize::{ Encoder, Decoder, Encodable, @@ -63,7 +65,7 @@ fn test_tuple() { #[test] fn test_basic_struct() { - #[deriving(Encodable, Decodable, PartialEq, Show)] + #[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)] struct Easy { x: int, s: String, @@ -74,13 +76,13 @@ fn test_basic_struct() { #[test] fn test_nested_struct() { - #[deriving(Encodable, Decodable, PartialEq, Show)] + #[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)] struct Easy { x: int, s: String, y: uint } - #[deriving(Encodable, Decodable, PartialEq, Show)] + #[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)] struct Nest { f: Easy, b: uint, @@ -96,7 +98,7 @@ fn test_nested_struct() { #[test] fn test_struct_tuple() { - #[deriving(Encodable, Decodable, PartialEq, Show)] + #[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)] struct TubStr(uint, String, f32); the_same(TubStr(5, "hello".to_string(), 3.2)); @@ -111,7 +113,7 @@ fn option() { #[test] fn enm() { - #[deriving(Encodable, Decodable, PartialEq, Show)] + #[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)] enum TestEnum { NoArg, OneArg(uint), @@ -125,7 +127,7 @@ fn enm() { #[test] fn struct_enum() { - #[deriving(Encodable, Decodable, PartialEq, Show)] + #[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)] enum TestEnum { NoArg, OneArg(uint), diff --git a/src/writer.rs b/src/writer.rs index 7c27ace..ac61687 100644 --- a/src/writer.rs +++ b/src/writer.rs @@ -1,5 +1,5 @@ use std::io::{Writer, IoError, IoResult}; -use serialize::Encoder; +use rustc_serialize::Encoder; type EwResult = IoResult<()>;