serialize crate has moved out of tree to rustc-serialize.
See commit b04bc5cc49
This commit is contained in:
parent
7e7bd12479
commit
8f982f334e
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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<Entity>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
16
src/test.rs
16
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),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use std::io::{Writer, IoError, IoResult};
|
||||
use serialize::Encoder;
|
||||
use rustc_serialize::Encoder;
|
||||
|
||||
type EwResult = IoResult<()>;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue