mirror of https://git.sr.ht/~stygianentity/bincode
added old_orphan_check feature to tests and examples
This commit is contained in:
parent
6e0069163c
commit
b873c9e75f
|
|
@ -17,16 +17,18 @@ library.
|
|||
## Example
|
||||
|
||||
```rust
|
||||
#![feature(old_orphan_check)]
|
||||
|
||||
extern crate bincode;
|
||||
extern crate "rustc-serialize" as rustc_serialize;
|
||||
|
||||
#[deriving(RustcEncodable, RustcDecodable, PartialEq)]
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq)]
|
||||
struct Entity {
|
||||
x: f32,
|
||||
y: f32,
|
||||
}
|
||||
|
||||
#[deriving(RustcEncodable, RustcDecodable, PartialEq)]
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq)]
|
||||
struct World {
|
||||
entities: Vec<Entity>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
#![feature(old_orphan_check)]
|
||||
|
||||
extern crate bincode;
|
||||
extern crate "rustc-serialize" as rustc_serialize;
|
||||
|
||||
#[deriving(RustcEncodable, RustcDecodable, PartialEq)]
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq)]
|
||||
struct Entity {
|
||||
x: f32,
|
||||
y: f32,
|
||||
}
|
||||
|
||||
#[deriving(RustcEncodable, RustcDecodable, PartialEq)]
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq)]
|
||||
struct World {
|
||||
entities: Vec<Entity>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#![crate_name = "bincode"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![feature(old_orphan_check)]
|
||||
|
||||
extern crate "rustc-serialize" as rustc_serialize;
|
||||
|
||||
|
|
|
|||
12
src/test.rs
12
src/test.rs
|
|
@ -65,7 +65,7 @@ fn test_tuple() {
|
|||
|
||||
#[test]
|
||||
fn test_basic_struct() {
|
||||
#[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
struct Easy {
|
||||
x: int,
|
||||
s: String,
|
||||
|
|
@ -76,13 +76,13 @@ fn test_basic_struct() {
|
|||
|
||||
#[test]
|
||||
fn test_nested_struct() {
|
||||
#[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
struct Easy {
|
||||
x: int,
|
||||
s: String,
|
||||
y: uint
|
||||
}
|
||||
#[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
struct Nest {
|
||||
f: Easy,
|
||||
b: uint,
|
||||
|
|
@ -98,7 +98,7 @@ fn test_nested_struct() {
|
|||
|
||||
#[test]
|
||||
fn test_struct_tuple() {
|
||||
#[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
struct TubStr(uint, String, f32);
|
||||
|
||||
the_same(TubStr(5, "hello".to_string(), 3.2));
|
||||
|
|
@ -113,7 +113,7 @@ fn option() {
|
|||
|
||||
#[test]
|
||||
fn enm() {
|
||||
#[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
enum TestEnum {
|
||||
NoArg,
|
||||
OneArg(uint),
|
||||
|
|
@ -127,7 +127,7 @@ fn enm() {
|
|||
|
||||
#[test]
|
||||
fn struct_enum() {
|
||||
#[deriving(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
#[derive(RustcEncodable, RustcDecodable, PartialEq, Show)]
|
||||
enum TestEnum {
|
||||
NoArg,
|
||||
OneArg(uint),
|
||||
|
|
|
|||
Loading…
Reference in New Issue