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