sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rs
This commit is contained in:
parent
8c5bb80d9b
commit
351409a622
231 changed files with 1115 additions and 1115 deletions
|
@ -60,7 +60,7 @@
|
|||
//! To be able to encode a piece of data, it must implement the `serialize::RustcEncodable` trait.
|
||||
//! To be able to decode a piece of data, it must implement the `serialize::RustcDecodable` trait.
|
||||
//! The Rust compiler provides an annotation to automatically generate the code for these traits:
|
||||
//! `#[deriving(RustcDecodable, RustcEncodable)]`
|
||||
//! `#[derive(RustcDecodable, RustcEncodable)]`
|
||||
//!
|
||||
//! The JSON API provides an enum `json::Json` and a trait `ToJson` to encode objects.
|
||||
//! The `ToJson` trait provides a `to_json` method to convert an object into a `json::Json` value.
|
||||
|
@ -82,7 +82,7 @@
|
|||
//! use serialize::json;
|
||||
//!
|
||||
//! // Automatically generate `Decodable` and `Encodable` trait implementations
|
||||
//! #[deriving(RustcDecodable, RustcEncodable)]
|
||||
//! #[derive(RustcDecodable, RustcEncodable)]
|
||||
//! pub struct TestStruct {
|
||||
//! data_int: u8,
|
||||
//! data_str: String,
|
||||
|
@ -130,7 +130,7 @@
|
|||
//! }
|
||||
//!
|
||||
//! // Only generate `RustcEncodable` trait implementation
|
||||
//! #[deriving(Encodable)]
|
||||
//! #[derive(Encodable)]
|
||||
//! pub struct ComplexNumRecord {
|
||||
//! uid: u8,
|
||||
//! dsc: String,
|
||||
|
@ -158,7 +158,7 @@
|
|||
//! use serialize::json::{self, Json, ToJson};
|
||||
//!
|
||||
//! // Only generate `Decodable` trait implementation
|
||||
//! #[deriving(Decodable)]
|
||||
//! #[derive(Decodable)]
|
||||
//! pub struct TestStruct {
|
||||
//! data_int: u8,
|
||||
//! data_str: String,
|
||||
|
@ -215,7 +215,7 @@ use unicode::str::Utf16Item;
|
|||
use Encodable;
|
||||
|
||||
/// Represents a json value
|
||||
#[deriving(Clone, PartialEq, PartialOrd)]
|
||||
#[derive(Clone, PartialEq, PartialOrd)]
|
||||
pub enum Json {
|
||||
I64(i64),
|
||||
U64(u64),
|
||||
|
@ -236,7 +236,7 @@ pub struct AsJson<'a, T: 'a> { inner: &'a T }
|
|||
pub struct AsPrettyJson<'a, T: 'a> { inner: &'a T, indent: Option<uint> }
|
||||
|
||||
/// The errors that can arise while parsing a JSON stream.
|
||||
#[deriving(Clone, Copy, PartialEq)]
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
pub enum ErrorCode {
|
||||
InvalidSyntax,
|
||||
InvalidNumber,
|
||||
|
@ -257,7 +257,7 @@ pub enum ErrorCode {
|
|||
NotUtf8,
|
||||
}
|
||||
|
||||
#[deriving(Clone, Copy, PartialEq, Show)]
|
||||
#[derive(Clone, Copy, PartialEq, Show)]
|
||||
pub enum ParserError {
|
||||
/// msg, line, col
|
||||
SyntaxError(ErrorCode, uint, uint),
|
||||
|
@ -267,7 +267,7 @@ pub enum ParserError {
|
|||
// Builder and Parser have the same errors.
|
||||
pub type BuilderError = ParserError;
|
||||
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
#[derive(Clone, PartialEq, Show)]
|
||||
pub enum DecoderError {
|
||||
ParseError(ParserError),
|
||||
ExpectedError(string::String, string::String),
|
||||
|
@ -1164,7 +1164,7 @@ impl ops::Index<uint> for Json {
|
|||
}
|
||||
|
||||
/// The output of the streaming parser.
|
||||
#[deriving(PartialEq, Clone, Show)]
|
||||
#[derive(PartialEq, Clone, Show)]
|
||||
pub enum JsonEvent {
|
||||
ObjectStart,
|
||||
ObjectEnd,
|
||||
|
@ -1179,7 +1179,7 @@ pub enum JsonEvent {
|
|||
Error(ParserError),
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Show)]
|
||||
#[derive(PartialEq, Show)]
|
||||
enum ParserState {
|
||||
// Parse a value in an array, true means first element.
|
||||
ParseArray(bool),
|
||||
|
@ -1208,7 +1208,7 @@ pub struct Stack {
|
|||
/// StackElements compose a Stack.
|
||||
/// For example, Key("foo"), Key("bar"), Index(3) and Key("x") are the
|
||||
/// StackElements compositing the stack that represents foo.bar[3].x
|
||||
#[deriving(PartialEq, Clone, Show)]
|
||||
#[derive(PartialEq, Clone, Show)]
|
||||
pub enum StackElement<'l> {
|
||||
Index(u32),
|
||||
Key(&'l str),
|
||||
|
@ -1216,7 +1216,7 @@ pub enum StackElement<'l> {
|
|||
|
||||
// Internally, Key elements are stored as indices in a buffer to avoid
|
||||
// allocating a string for every member of an object.
|
||||
#[deriving(PartialEq, Clone, Show)]
|
||||
#[derive(PartialEq, Clone, Show)]
|
||||
enum InternalStackElement {
|
||||
InternalIndex(u32),
|
||||
InternalKey(u16, u16), // start, size
|
||||
|
@ -2534,7 +2534,7 @@ mod tests {
|
|||
use std::num::Float;
|
||||
use std::string;
|
||||
|
||||
#[deriving(RustcDecodable, Eq, PartialEq, Show)]
|
||||
#[derive(RustcDecodable, Eq, PartialEq, Show)]
|
||||
struct OptionData {
|
||||
opt: Option<uint>,
|
||||
}
|
||||
|
@ -2561,20 +2561,20 @@ mod tests {
|
|||
ExpectedError("Number".to_string(), "false".to_string()));
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, RustcEncodable, RustcDecodable, Show)]
|
||||
#[derive(PartialEq, RustcEncodable, RustcDecodable, Show)]
|
||||
enum Animal {
|
||||
Dog,
|
||||
Frog(string::String, int)
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, RustcEncodable, RustcDecodable, Show)]
|
||||
#[derive(PartialEq, RustcEncodable, RustcDecodable, Show)]
|
||||
struct Inner {
|
||||
a: (),
|
||||
b: uint,
|
||||
c: Vec<string::String>,
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, RustcEncodable, RustcDecodable, Show)]
|
||||
#[derive(PartialEq, RustcEncodable, RustcDecodable, Show)]
|
||||
struct Outer {
|
||||
inner: Vec<Inner>,
|
||||
}
|
||||
|
@ -3093,7 +3093,7 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[deriving(RustcDecodable)]
|
||||
#[derive(RustcDecodable)]
|
||||
struct FloatStruct {
|
||||
f: f64,
|
||||
a: Vec<f64>
|
||||
|
@ -3142,7 +3142,7 @@ mod tests {
|
|||
Err(SyntaxError(EOFWhileParsingObject, 3u, 8u)));
|
||||
}
|
||||
|
||||
#[deriving(RustcDecodable)]
|
||||
#[derive(RustcDecodable)]
|
||||
#[allow(dead_code)]
|
||||
struct DecodeStruct {
|
||||
x: f64,
|
||||
|
@ -3150,7 +3150,7 @@ mod tests {
|
|||
z: string::String,
|
||||
w: Vec<DecodeStruct>
|
||||
}
|
||||
#[deriving(RustcDecodable)]
|
||||
#[derive(RustcDecodable)]
|
||||
enum DecodeEnum {
|
||||
A(f64),
|
||||
B(string::String)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue