json serialization
List
Object
Json
- Represents a json valueDecoder
- A structure to decode JSON to values in rust.Encoder
- A structure for implementing serialization to JSON.Error
- If an error occurs while parsing some JSON, this is the structure which is returnedParser
PrettyEncoder
- Another encoder for JSON, but prints out human-readable JSON instead of compact dataof ::std::cmp::Eq for Error
- Automatically derived.of serialize::Encoder for Encoder
of serialize::Encoder for PrettyEncoder
of serialize::Encodable<E> for Json where <E: serialize::Encoder>
for Parser
of serialize::Decoder for Decoder
of Eq for Json
of Ord for Json
- Test if two json values are less than one anotherof ToJson for Json
of ToJson for @Json
of ToJson for int
of ToJson for i8
of ToJson for i16
of ToJson for i32
of ToJson for i64
of ToJson for uint
of ToJson for u8
of ToJson for u16
of ToJson for u32
of ToJson for u64
of ToJson for float
of ToJson for f32
of ToJson for f64
of ToJson for ()
of ToJson for bool
of ToJson for ~str
of ToJson for @~str
of ToJson for (A, B) where <A: ToJson, B: ToJson>
of ToJson for (A, B, C) where <A: ToJson, B: ToJson, C: ToJson>
of ToJson for ~[A] where <A: ToJson>
of ToJson for HashMap<~str, A> where <A: ToJson + Copy>
of ToJson for Option<A> where <A: ToJson>
of to_str::ToStr for Json
of to_str::ToStr for Error
Decoder
- Creates a new decoder instance for decoding the specified JSON value.Encoder
- Creates a new JSON encoder whose output will be written to the writer specified.Parser
- Decode a json value from an io::readerPrettyEncoder
- Creates a new encoder whose output will be written to the specified writerfrom_reader
- Decodes a json value from an @io::Readerfrom_str
- Decodes a json value from a stringto_pretty_str
- Encodes a json value into a stringto_pretty_writer
- Encodes a json value into a io::writerto_str
- Encodes a json value into a stringto_writer
- Encodes a json value into a io::writerList
type List = ~[Json]
Object
type Object = HashMap<~str, Json>
Json
Represents a json value
Number(float)
String(~str)
Boolean(bool)
List(List)
Object(~Object)
Null
Decoder
pub struct Decoder {
priv stack: ~[Json],
}
A structure to decode JSON to values in rust.
Encoder
pub struct Encoder {
priv wr: @io::Writer,
}
A structure for implementing serialization to JSON.
Error
pub struct Error {
/// The line number at which the error occurred
line: uint,
/// The column number at which the error occurred
col: uint,
/// A message describing the type of the error
msg: @~str,
}
If an error occurs while parsing some JSON, this is the structure which is returned
Parser
pub struct Parser {
priv rdr: @io::Reader,
priv ch: char,
priv line: uint,
priv col: uint,
}
PrettyEncoder
pub struct PrettyEncoder {
priv wr: @io::Writer,
priv indent: uint,
}
Another encoder for JSON, but prints out human-readable JSON instead of compact data
::std::cmp::Eq
for Error
Automatically derived.
eq
fn eq(&self, __arg_0: &Error) -> ::bool
ne
fn ne(&self, __arg_0: &Error) -> ::bool
serialize::Encoder
for Encoder
emit_nil
fn emit_nil(&mut self)
emit_uint
fn emit_uint(&mut self, v: uint)
emit_u64
fn emit_u64(&mut self, v: u64)
emit_u32
fn emit_u32(&mut self, v: u32)
emit_u16
fn emit_u16(&mut self, v: u16)
emit_u8
fn emit_u8(&mut self, v: u8)
emit_int
fn emit_int(&mut self, v: int)
emit_i64
fn emit_i64(&mut self, v: i64)
emit_i32
fn emit_i32(&mut self, v: i32)
emit_i16
fn emit_i16(&mut self, v: i16)
emit_i8
fn emit_i8(&mut self, v: i8)
emit_bool
fn emit_bool(&mut self, v: bool)
emit_f64
fn emit_f64(&mut self, v: f64)
emit_f32
fn emit_f32(&mut self, v: f32)
emit_float
fn emit_float(&mut self, v: float)
emit_char
fn emit_char(&mut self, v: char)
emit_str
fn emit_str(&mut self, v: &str)
emit_enum
fn emit_enum(&mut self, _name: &str, f: &fn(&mut Encoder))
emit_enum_variant
fn emit_enum_variant(&mut self, name: &str, _id: uint, cnt: uint,
f: &fn(&mut Encoder))
emit_enum_variant_arg
fn emit_enum_variant_arg(&mut self, idx: uint, f: &fn(&mut Encoder))
emit_enum_struct_variant
fn emit_enum_struct_variant(&mut self, name: &str, id: uint, cnt: uint,
f: &fn(&mut Encoder))
emit_enum_struct_variant_field
fn emit_enum_struct_variant_field(&mut self, _: &str, idx: uint,
f: &fn(&mut Encoder))
emit_struct
fn emit_struct(&mut self, _: &str, _: uint, f: &fn(&mut Encoder))
emit_struct_field
fn emit_struct_field(&mut self, name: &str, idx: uint, f: &fn(&mut Encoder))
emit_tuple
fn emit_tuple(&mut self, len: uint, f: &fn(&mut Encoder))
emit_tuple_arg
fn emit_tuple_arg(&mut self, idx: uint, f: &fn(&mut Encoder))
emit_tuple_struct
fn emit_tuple_struct(&mut self, _name: &str, len: uint, f: &fn(&mut Encoder))
emit_tuple_struct_arg
fn emit_tuple_struct_arg(&mut self, idx: uint, f: &fn(&mut Encoder))
emit_option
fn emit_option(&mut self, f: &fn(&mut Encoder))
emit_option_none
fn emit_option_none(&mut self)
emit_option_some
fn emit_option_some(&mut self, f: &fn(&mut Encoder))
emit_seq
fn emit_seq(&mut self, _len: uint, f: &fn(&mut Encoder))
emit_seq_elt
fn emit_seq_elt(&mut self, idx: uint, f: &fn(&mut Encoder))
emit_map
fn emit_map(&mut self, _len: uint, f: &fn(&mut Encoder))
emit_map_elt_key
fn emit_map_elt_key(&mut self, idx: uint, f: &fn(&mut Encoder))
emit_map_elt_val
fn emit_map_elt_val(&mut self, _idx: uint, f: &fn(&mut Encoder))
serialize::Encoder
for PrettyEncoder
emit_nil
fn emit_nil(&mut self)
emit_uint
fn emit_uint(&mut self, v: uint)
emit_u64
fn emit_u64(&mut self, v: u64)
emit_u32
fn emit_u32(&mut self, v: u32)
emit_u16
fn emit_u16(&mut self, v: u16)
emit_u8
fn emit_u8(&mut self, v: u8)
emit_int
fn emit_int(&mut self, v: int)
emit_i64
fn emit_i64(&mut self, v: i64)
emit_i32
fn emit_i32(&mut self, v: i32)
emit_i16
fn emit_i16(&mut self, v: i16)
emit_i8
fn emit_i8(&mut self, v: i8)
emit_bool
fn emit_bool(&mut self, v: bool)
emit_f64
fn emit_f64(&mut self, v: f64)
emit_f32
fn emit_f32(&mut self, v: f32)
emit_float
fn emit_float(&mut self, v: float)
emit_char
fn emit_char(&mut self, v: char)
emit_str
fn emit_str(&mut self, v: &str)
emit_enum
fn emit_enum(&mut self, _name: &str, f: &fn(&mut PrettyEncoder))
emit_enum_variant
fn emit_enum_variant(&mut self, name: &str, _: uint, cnt: uint,
f: &fn(&mut PrettyEncoder))
emit_enum_variant_arg
fn emit_enum_variant_arg(&mut self, idx: uint, f: &fn(&mut PrettyEncoder))
emit_enum_struct_variant
fn emit_enum_struct_variant(&mut self, name: &str, id: uint, cnt: uint,
f: &fn(&mut PrettyEncoder))
emit_enum_struct_variant_field
fn emit_enum_struct_variant_field(&mut self, _: &str, idx: uint,
f: &fn(&mut PrettyEncoder))
emit_struct
fn emit_struct(&mut self, _: &str, len: uint, f: &fn(&mut PrettyEncoder))
emit_struct_field
fn emit_struct_field(&mut self, name: &str, idx: uint,
f: &fn(&mut PrettyEncoder))
emit_tuple
fn emit_tuple(&mut self, len: uint, f: &fn(&mut PrettyEncoder))
emit_tuple_arg
fn emit_tuple_arg(&mut self, idx: uint, f: &fn(&mut PrettyEncoder))
emit_tuple_struct
fn emit_tuple_struct(&mut self, _: &str, len: uint,
f: &fn(&mut PrettyEncoder))
emit_tuple_struct_arg
fn emit_tuple_struct_arg(&mut self, idx: uint, f: &fn(&mut PrettyEncoder))
emit_option
fn emit_option(&mut self, f: &fn(&mut PrettyEncoder))
emit_option_none
fn emit_option_none(&mut self)
emit_option_some
fn emit_option_some(&mut self, f: &fn(&mut PrettyEncoder))
emit_seq
fn emit_seq(&mut self, len: uint, f: &fn(&mut PrettyEncoder))
emit_seq_elt
fn emit_seq_elt(&mut self, idx: uint, f: &fn(&mut PrettyEncoder))
emit_map
fn emit_map(&mut self, len: uint, f: &fn(&mut PrettyEncoder))
emit_map_elt_key
fn emit_map_elt_key(&mut self, idx: uint, f: &fn(&mut PrettyEncoder))
emit_map_elt_val
fn emit_map_elt_val(&mut self, _idx: uint, f: &fn(&mut PrettyEncoder))
serialize::Encodable<E>
for Json
where <E: serialize::Encoder>
encode
fn encode(&self, e: &mut E)
Parser
parse
fn parse(&mut self) -> Result<Json, Error>
serialize::Decoder
for Decoder
read_nil
fn read_nil(&mut self)
read_u64
fn read_u64(&mut self) -> u64
read_u32
fn read_u32(&mut self) -> u32
read_u16
fn read_u16(&mut self) -> u16
read_u8
fn read_u8(&mut self) -> u8
read_uint
fn read_uint(&mut self) -> uint
read_i64
fn read_i64(&mut self) -> i64
read_i32
fn read_i32(&mut self) -> i32
read_i16
fn read_i16(&mut self) -> i16
read_i8
fn read_i8(&mut self) -> i8
read_int
fn read_int(&mut self) -> int
read_bool
fn read_bool(&mut self) -> bool
read_f64
fn read_f64(&mut self) -> f64
read_f32
fn read_f32(&mut self) -> f32
read_float
fn read_float(&mut self) -> float
read_char
fn read_char(&mut self) -> char
read_str
fn read_str(&mut self) -> ~str
read_enum
fn read_enum<T>(&mut self, name: &str, f: &fn(&mut Decoder) -> T) -> T
read_enum_variant
fn read_enum_variant<T>(&mut self, names: &[&str],
f: &fn(&mut Decoder, uint) -> T) -> T
read_enum_variant_arg
fn read_enum_variant_arg<T>(&mut self, idx: uint, f: &fn(&mut Decoder) -> T)
-> T
read_enum_struct_variant
fn read_enum_struct_variant<T>(&mut self, names: &[&str],
f: &fn(&mut Decoder, uint) -> T) -> T
read_enum_struct_variant_field
fn read_enum_struct_variant_field<T>(&mut self, name: &str, idx: uint,
f: &fn(&mut Decoder) -> T) -> T
read_struct
fn read_struct<T>(&mut self, name: &str, len: uint, f: &fn(&mut Decoder) -> T)
-> T
read_struct_field
fn read_struct_field<T>(&mut self, name: &str, idx: uint,
f: &fn(&mut Decoder) -> T) -> T
read_tuple
fn read_tuple<T>(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T
read_tuple_arg
fn read_tuple_arg<T>(&mut self, idx: uint, f: &fn(&mut Decoder) -> T) -> T
read_tuple_struct
fn read_tuple_struct<T>(&mut self, name: &str,
f: &fn(&mut Decoder, uint) -> T) -> T
read_tuple_struct_arg
fn read_tuple_struct_arg<T>(&mut self, idx: uint, f: &fn(&mut Decoder) -> T)
-> T
read_option
fn read_option<T>(&mut self, f: &fn(&mut Decoder, bool) -> T) -> T
read_seq
fn read_seq<T>(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T
read_seq_elt
fn read_seq_elt<T>(&mut self, idx: uint, f: &fn(&mut Decoder) -> T) -> T
read_map
fn read_map<T>(&mut self, f: &fn(&mut Decoder, uint) -> T) -> T
read_map_elt_key
fn read_map_elt_key<T>(&mut self, idx: uint, f: &fn(&mut Decoder) -> T) -> T
read_map_elt_val
fn read_map_elt_val<T>(&mut self, idx: uint, f: &fn(&mut Decoder) -> T) -> T
Eq
for Json
eq
fn eq(&self, other: &Json) -> bool
ne
fn ne(&self, other: &Json) -> bool
Ord
for Json
Test if two json values are less than one another
lt
fn lt(&self, other: &Json) -> bool
le
fn le(&self, other: &Json) -> bool
ge
fn ge(&self, other: &Json) -> bool
gt
fn gt(&self, other: &Json) -> bool
ToJson
for Json
to_json
fn to_json(&self) -> Json
ToJson
for @Json
to_json
fn to_json(&self) -> Json
ToJson
for int
to_json
fn to_json(&self) -> Json
ToJson
for i8
to_json
fn to_json(&self) -> Json
ToJson
for i16
to_json
fn to_json(&self) -> Json
ToJson
for i32
to_json
fn to_json(&self) -> Json
ToJson
for i64
to_json
fn to_json(&self) -> Json
ToJson
for uint
to_json
fn to_json(&self) -> Json
ToJson
for u8
to_json
fn to_json(&self) -> Json
ToJson
for u16
to_json
fn to_json(&self) -> Json
ToJson
for u32
to_json
fn to_json(&self) -> Json
ToJson
for u64
to_json
fn to_json(&self) -> Json
ToJson
for float
to_json
fn to_json(&self) -> Json
ToJson
for f32
to_json
fn to_json(&self) -> Json
ToJson
for f64
to_json
fn to_json(&self) -> Json
ToJson
for ()
to_json
fn to_json(&self) -> Json
ToJson
for bool
to_json
fn to_json(&self) -> Json
ToJson
for ~str
to_json
fn to_json(&self) -> Json
ToJson
for @~str
to_json
fn to_json(&self) -> Json
ToJson
for (A, B)
where <A: ToJson, B: ToJson>
to_json
fn to_json(&self) -> Json
ToJson
for (A, B, C)
where <A: ToJson, B: ToJson, C: ToJson>
to_json
fn to_json(&self) -> Json
ToJson
for ~[A]
where <A: ToJson>
to_json
fn to_json(&self) -> Json
ToJson
for HashMap<~str, A>
where <A: ToJson + Copy>
to_json
fn to_json(&self) -> Json
ToJson
for Option<A>
where <A: ToJson>
to_json
fn to_json(&self) -> Json
to_str::ToStr
for Json
to_str
fn to_str(&self) -> ~str
to_str::ToStr
for Error
to_str
fn to_str(&self) -> ~str
Decoder
fn Decoder(json: Json) -> Decoder
Creates a new decoder instance for decoding the specified JSON value.
Encoder
fn Encoder(wr: @io::Writer) -> Encoder
Creates a new JSON encoder whose output will be written to the writer specified.
Parser
fn Parser(rdr: @io::Reader) -> Parser
Decode a json value from an io::reader
PrettyEncoder
fn PrettyEncoder(wr: @io::Writer) -> PrettyEncoder
Creates a new encoder whose output will be written to the specified writer
from_reader
fn from_reader(rdr: @io::Reader) -> Result<Json, Error>
Decodes a json value from an @io::Reader
from_str
fn from_str(s: &str) -> Result<Json, Error>
Decodes a json value from a string
to_pretty_str
fn to_pretty_str(json: &Json) -> ~str
Encodes a json value into a string
to_pretty_writer
fn to_pretty_writer(wr: @io::Writer, json: &Json)
Encodes a json value into a io::writer
to_str
fn to_str(json: &Json) -> ~str
Encodes a json value into a string
to_writer
fn to_writer(wr: @io::Writer, json: &Json)
Encodes a json value into a io::writer