Update to rust HEAD (2f221c)
This commit is contained in:
parent
c58958b1c8
commit
dac51fe4d2
@ -6,7 +6,7 @@ use de::{Deserializer, Deserializable, Token};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[deriving(Clone, Eq, Show, Decodable)]
|
||||
#[deriving(Clone, PartialEq, Show, Decodable)]
|
||||
enum Animal {
|
||||
Dog,
|
||||
Frog(String, int)
|
||||
|
@ -160,7 +160,7 @@ mod deserializer {
|
||||
|
||||
use de;
|
||||
|
||||
#[deriving(Eq, Show)]
|
||||
#[deriving(PartialEq, Show)]
|
||||
enum State {
|
||||
StartState,
|
||||
KeyOrEndState,
|
||||
@ -237,7 +237,7 @@ mod deserializer {
|
||||
fn run_decoder<
|
||||
E: Show,
|
||||
D: Decoder<E>,
|
||||
T: Clone + Eq + Show + Decodable<D, E>
|
||||
T: Clone + PartialEq + Show + Decodable<D, E>
|
||||
>(mut d: D, value: T) {
|
||||
let v: T = Decodable::decode(&mut d).unwrap();
|
||||
|
||||
@ -277,7 +277,7 @@ fn bench_decoder_100(b: &mut Bencher) {
|
||||
fn run_deserializer<
|
||||
E: Show,
|
||||
D: Deserializer<E>,
|
||||
T: Clone + Eq + Show + Deserializable<E, D>
|
||||
T: Clone + PartialEq + Show + Deserializable<E, D>
|
||||
>(mut d: D, value: T) {
|
||||
let v: T = Deserializable::deserialize(&mut d).unwrap();
|
||||
|
||||
|
@ -8,7 +8,7 @@ use de::{Token, Deserializer, Deserializable};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[deriving(Clone, Eq, Show, Decodable)]
|
||||
#[deriving(Clone, PartialEq, Show, Decodable)]
|
||||
struct Inner {
|
||||
a: (),
|
||||
b: uint,
|
||||
@ -74,7 +74,7 @@ impl<E, D: Deserializer<E>> Deserializable<E, D> for Inner {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[deriving(Clone, Eq, Show, Decodable)]
|
||||
#[deriving(Clone, PartialEq, Show, Decodable)]
|
||||
struct Outer {
|
||||
inner: Vec<Inner>,
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ mod deserializer {
|
||||
|
||||
use de;
|
||||
|
||||
#[deriving(Eq, Show)]
|
||||
#[deriving(PartialEq, Show)]
|
||||
enum State {
|
||||
StartState,
|
||||
SepOrEndState,
|
||||
@ -355,7 +355,7 @@ mod deserializer {
|
||||
fn run_decoder<
|
||||
E: Show,
|
||||
D: Decoder<E>,
|
||||
T: Clone + Eq + Show + Decodable<D, E>
|
||||
T: Clone + PartialEq + Show + Decodable<D, E>
|
||||
>(mut d: D, value: T) {
|
||||
let v: T = Decodable::decode(&mut d).unwrap();
|
||||
|
||||
@ -365,7 +365,7 @@ fn run_decoder<
|
||||
fn run_deserializer<
|
||||
E: Show,
|
||||
D: Deserializer<E>,
|
||||
T: Clone + Eq + Show + Deserializable<E, D>
|
||||
T: Clone + PartialEq + Show + Deserializable<E, D>
|
||||
>(mut d: D, value: T) {
|
||||
let v: T = Deserializable::deserialize(&mut d).unwrap();
|
||||
|
||||
|
10
de.rs
10
de.rs
@ -4,7 +4,7 @@ use std::hash::Hash;
|
||||
use std::num;
|
||||
use collections::{HashMap, TreeMap};
|
||||
|
||||
#[deriving(Clone, Eq, Show)]
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
pub enum Token {
|
||||
Null,
|
||||
Bool(bool),
|
||||
@ -413,7 +413,7 @@ impl<
|
||||
impl<
|
||||
E,
|
||||
D: Deserializer<E>,
|
||||
K: Deserializable<E, D> + Eq + TotalOrd,
|
||||
K: Deserializable<E, D> + TotalOrd,
|
||||
V: Deserializable<E, D>
|
||||
> Deserializable<E, D> for TreeMap<K, V> {
|
||||
#[inline]
|
||||
@ -690,7 +690,7 @@ mod tests {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[deriving(Clone, Eq, Show, Decodable)]
|
||||
#[deriving(Clone, PartialEq, Show, Decodable)]
|
||||
struct Inner {
|
||||
a: (),
|
||||
b: uint,
|
||||
@ -711,7 +711,7 @@ mod tests {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[deriving(Clone, Eq, Show, Decodable)]
|
||||
#[deriving(Clone, PartialEq, Show, Decodable)]
|
||||
struct Outer {
|
||||
inner: Vec<Inner>,
|
||||
}
|
||||
@ -728,7 +728,7 @@ mod tests {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#[deriving(Clone, Eq, Show, Decodable)]
|
||||
#[deriving(Clone, PartialEq, Show, Decodable)]
|
||||
enum Animal {
|
||||
Dog,
|
||||
Frog(String, int)
|
||||
|
22
json.rs
22
json.rs
@ -252,7 +252,7 @@ use serialize;
|
||||
use serialize::{Encoder, Encodable};
|
||||
|
||||
/// Represents a json value
|
||||
#[deriving(Clone, Eq)]
|
||||
#[deriving(Clone, PartialEq)]
|
||||
pub enum Json {
|
||||
Null,
|
||||
Boolean(bool),
|
||||
@ -491,7 +491,7 @@ impl de::Deserializer<ParserError> for JsonDeserializer {
|
||||
}
|
||||
|
||||
/// The errors that can arise while parsing a JSON stream.
|
||||
#[deriving(Clone, Eq)]
|
||||
#[deriving(Clone, PartialEq)]
|
||||
pub enum ErrorCode {
|
||||
EOFWhileParsingList,
|
||||
EOFWhileParsingObject,
|
||||
@ -513,7 +513,7 @@ pub enum ErrorCode {
|
||||
UnrecognizedHex,
|
||||
}
|
||||
|
||||
#[deriving(Clone, Eq, Show)]
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
pub enum ParserError {
|
||||
/// msg, line, col
|
||||
SyntaxError(ErrorCode, uint, uint),
|
||||
@ -1230,7 +1230,7 @@ pub enum JsonEvent {
|
||||
}
|
||||
*/
|
||||
|
||||
#[deriving(Eq, Show)]
|
||||
#[deriving(PartialEq, Show)]
|
||||
enum ParserState {
|
||||
// Parse a value.
|
||||
ParseValue,
|
||||
@ -2347,7 +2347,7 @@ impl ::Decoder<DecoderError> for Decoder {
|
||||
*/
|
||||
|
||||
/// Test if two json values are less than one another
|
||||
impl Ord for Json {
|
||||
impl PartialOrd for Json {
|
||||
fn lt(&self, other: &Json) -> bool {
|
||||
match *self {
|
||||
Number(f0) => {
|
||||
@ -2577,7 +2577,7 @@ mod tests {
|
||||
})
|
||||
}
|
||||
|
||||
#[deriving(Eq, Show)]
|
||||
#[deriving(PartialEq, Show)]
|
||||
enum Animal {
|
||||
Dog,
|
||||
Frog(String, int)
|
||||
@ -2620,7 +2620,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[deriving(Eq, Show)]
|
||||
#[deriving(PartialEq, Show)]
|
||||
struct Inner {
|
||||
a: (),
|
||||
b: uint,
|
||||
@ -2696,7 +2696,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[deriving(Eq, Show)]
|
||||
#[deriving(PartialEq, Show)]
|
||||
struct Outer {
|
||||
inner: Vec<Inner>,
|
||||
}
|
||||
@ -3009,7 +3009,7 @@ mod tests {
|
||||
// FIXME (#5527): these could be merged once UFCS is finished.
|
||||
fn test_parse_err<
|
||||
'a,
|
||||
T: Eq + Show + de::Deserializable<ParserError, Parser<str::Chars<'a>>>
|
||||
T: Show + de::Deserializable<ParserError, Parser<str::Chars<'a>>>
|
||||
>(errors: &[(&'a str, ParserError)]) {
|
||||
for &(s, ref err) in errors.iter() {
|
||||
let v: Result<T, ParserError> = from_iter(s.chars());
|
||||
@ -3019,7 +3019,7 @@ mod tests {
|
||||
|
||||
fn test_parse_ok<
|
||||
'a,
|
||||
T: Eq + Show + ToJson + de::Deserializable<ParserError, Parser<str::Chars<'a>>>
|
||||
T: PartialEq + Show + ToJson + de::Deserializable<ParserError, Parser<str::Chars<'a>>>
|
||||
>(errors: &[(&'a str, T)]) {
|
||||
for &(s, ref value) in errors.iter() {
|
||||
let v: T = from_iter(s.chars()).unwrap();
|
||||
@ -3031,7 +3031,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn test_json_deserialize_ok<
|
||||
T: Eq + Show + ToJson + de::Deserializable<ParserError, JsonDeserializer>
|
||||
T: PartialEq + Show + ToJson + de::Deserializable<ParserError, JsonDeserializer>
|
||||
>(errors: &[T]) {
|
||||
for value in errors.iter() {
|
||||
let v: T = from_json(value.to_json()).unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user