json serialization

Type List

type List = ~[Json]

Type Object

type Object = linear::LinearMap<~str, Json>

Enum Json

Represents a json value

Variants

Struct Deserializer

pub struct Deserializer {
        priv json: Json,
        priv mut stack: ~[& Json],
    }

Struct Error

pub struct Error {
        line: uint,
        col: uint,
        msg: @~str,
    }

Struct Parser

pub struct Parser {
        priv rdr: io::Reader,
        priv mut ch: char,
        priv mut line: uint,
        priv mut col: uint,
    }

Struct PrettySerializer

pub struct PrettySerializer {
        priv wr: io::Writer,
        priv mut indent: uint,
    }

Struct Serializer

pub struct Serializer {
        priv wr: io::Writer,
    }

Interface ToJson

Method to_json

fn to_json() -> Json

Implementation of serialization::Serializer for Serializer

Method emit_nil

fn emit_nil()

Method emit_uint

fn emit_uint(v: uint)

Method emit_u64

fn emit_u64(v: u64)

Method emit_u32

fn emit_u32(v: u32)

Method emit_u16

fn emit_u16(v: u16)

Method emit_u8

fn emit_u8(v: u8)

Method emit_int

fn emit_int(v: int)

Method emit_i64

fn emit_i64(v: i64)

Method emit_i32

fn emit_i32(v: i32)

Method emit_i16

fn emit_i16(v: i16)

Method emit_i8

fn emit_i8(v: i8)

Method emit_bool

fn emit_bool(v: bool)

Method emit_f64

fn emit_f64(v: f64)

Method emit_f32

fn emit_f32(v: f32)

Method emit_float

fn emit_float(v: float)

Method emit_char

fn emit_char(v: char)

Method emit_borrowed_str

fn emit_borrowed_str(v: & str)

Method emit_owned_str

fn emit_owned_str(v: & str)

Method emit_managed_str

fn emit_managed_str(v: & str)

Method emit_borrowed

fn emit_borrowed(f: fn&())

Method emit_owned

fn emit_owned(f: fn&())

Method emit_managed

fn emit_managed(f: fn&())

Method emit_enum

fn emit_enum(name: & str, f: fn&())

Method emit_enum_variant

fn emit_enum_variant(_name: & str, id: uint, _cnt: uint, f: fn&())

Method emit_enum_variant_arg

fn emit_enum_variant_arg(_idx: uint, f: fn&())

Method emit_borrowed_vec

fn emit_borrowed_vec(_len: uint, f: fn&())

Method emit_owned_vec

fn emit_owned_vec(len: uint, f: fn&())

Method emit_managed_vec

fn emit_managed_vec(len: uint, f: fn&())

Method emit_vec_elt

fn emit_vec_elt(idx: uint, f: fn&())

Method emit_rec

fn emit_rec(f: fn&())

Method emit_struct

fn emit_struct(_name: & str, f: fn&())

Method emit_field

fn emit_field(name: & str, idx: uint, f: fn&())

Method emit_tup

fn emit_tup(len: uint, f: fn&())

Method emit_tup_elt

fn emit_tup_elt(idx: uint, f: fn&())

Implementation of serialization::Serializer for PrettySerializer

Method emit_nil

fn emit_nil()

Method emit_uint

fn emit_uint(v: uint)

Method emit_u64

fn emit_u64(v: u64)

Method emit_u32

fn emit_u32(v: u32)

Method emit_u16

fn emit_u16(v: u16)

Method emit_u8

fn emit_u8(v: u8)

Method emit_int

fn emit_int(v: int)

Method emit_i64

fn emit_i64(v: i64)

Method emit_i32

fn emit_i32(v: i32)

Method emit_i16

fn emit_i16(v: i16)

Method emit_i8

fn emit_i8(v: i8)

Method emit_bool

fn emit_bool(v: bool)

Method emit_f64

fn emit_f64(v: f64)

Method emit_f32

fn emit_f32(v: f32)

Method emit_float

fn emit_float(v: float)

Method emit_char

fn emit_char(v: char)

Method emit_borrowed_str

fn emit_borrowed_str(v: & str)

Method emit_owned_str

fn emit_owned_str(v: & str)

Method emit_managed_str

fn emit_managed_str(v: & str)

Method emit_borrowed

fn emit_borrowed(f: fn&())

Method emit_owned

fn emit_owned(f: fn&())

Method emit_managed

fn emit_managed(f: fn&())

Method emit_enum

fn emit_enum(name: & str, f: fn&())

Method emit_enum_variant

fn emit_enum_variant(_name: & str, id: uint, _cnt: uint, f: fn&())

Method emit_enum_variant_arg

fn emit_enum_variant_arg(_idx: uint, f: fn&())

Method emit_borrowed_vec

fn emit_borrowed_vec(_len: uint, f: fn&())

Method emit_owned_vec

fn emit_owned_vec(len: uint, f: fn&())

Method emit_managed_vec

fn emit_managed_vec(len: uint, f: fn&())

Method emit_vec_elt

fn emit_vec_elt(idx: uint, f: fn&())

Method emit_rec

fn emit_rec(f: fn&())

Method emit_struct

fn emit_struct(_name: & str, f: fn&())

Method emit_field

fn emit_field(name: & str, idx: uint, f: fn&())

Method emit_tup

fn emit_tup(sz: uint, f: fn&())

Method emit_tup_elt

fn emit_tup_elt(idx: uint, f: fn&())

Implementation of serialization::Serializable for Json

Method serialize

fn serialize<S: serialization::Serializer>(s: & S)

Implementation for Parser

Method parse

fn parse() -> Result<Json, Error>

Implementation for Parser

Method eof

fn eof() -> bool

Method bump

fn bump()

Method next_char

fn next_char() -> char

Method error

fn error<T>(msg: ~str) -> Result<T, Error>

Method parse_value

fn parse_value() -> Result<Json, Error>

Method parse_whitespace

fn parse_whitespace()

Method parse_ident

fn parse_ident(ident: & str, value: Json) -> Result<Json, Error>

Method parse_number

fn parse_number() -> Result<Json, Error>

Method parse_integer

fn parse_integer() -> Result<float, Error>

Method parse_decimal

fn parse_decimal(res: float) -> Result<float, Error>

Method parse_exponent

fn parse_exponent(res: float) -> Result<float, Error>

Method parse_str

fn parse_str() -> Result<~str, Error>

Method parse_list

fn parse_list() -> Result<Json, Error>

Method parse_object

fn parse_object() -> Result<Json, Error>

Implementation for Deserializer

Method peek

fn peek() -> &self /Json

Method pop

fn pop() -> &self /Json

Implementation of serialization::Deserializer for Deserializer

Method read_nil

fn read_nil()

Method read_u64

fn read_u64() -> u64

Method read_u32

fn read_u32() -> u32

Method read_u16

fn read_u16() -> u16

Method read_u8

fn read_u8() -> u8

Method read_uint

fn read_uint() -> uint

Method read_i64

fn read_i64() -> i64

Method read_i32

fn read_i32() -> i32

Method read_i16

fn read_i16() -> i16

Method read_i8

fn read_i8() -> i8

Method read_int

fn read_int() -> int

Method read_bool

fn read_bool() -> bool

Method read_f64

fn read_f64() -> f64

Method read_f32

fn read_f32() -> f32

Method read_float

fn read_float() -> float

Method read_char

fn read_char() -> char

Method read_owned_str

fn read_owned_str() -> ~str

Method read_managed_str

fn read_managed_str() -> @str

Method read_owned

fn read_owned<T>(f: fn&() -> T) -> T

Method read_managed

fn read_managed<T>(f: fn&() -> T) -> T

Method read_enum

fn read_enum<T>(name: & str, f: fn&() -> T) -> T

Method read_enum_variant

fn read_enum_variant<T>(f: fn&(uint) -> T) -> T

Method read_enum_variant_arg

fn read_enum_variant_arg<T>(idx: uint, f: fn&() -> T) -> T

Method read_owned_vec

fn read_owned_vec<T>(f: fn&(uint) -> T) -> T

Method read_managed_vec

fn read_managed_vec<T>(f: fn&(uint) -> T) -> T

Method read_vec_elt

fn read_vec_elt<T>(idx: uint, f: fn&() -> T) -> T

Method read_rec

fn read_rec<T>(f: fn&() -> T) -> T

Method read_struct

fn read_struct<T>(_name: & str, f: fn&() -> T) -> T

Method read_field

fn read_field<T>(name: & str, idx: uint, f: fn&() -> T) -> T

Method read_tup

fn read_tup<T>(len: uint, f: fn&() -> T) -> T

Method read_tup_elt

fn read_tup_elt<T>(idx: uint, f: fn&() -> T) -> T

Implementation of Eq for Json

Method eq

fn eq(other: & Json) -> bool

Method ne

fn ne(other: & Json) -> bool

Implementation of Ord for Json

Test if two json values are less than one another

Method lt

fn lt(other: & Json) -> bool

Method le

fn le(other: & Json) -> bool

Method ge

fn ge(other: & Json) -> bool

Method gt

fn gt(other: & Json) -> bool

Implementation of Eq for Error

Method eq

fn eq(other: & Error) -> bool

Method ne

fn ne(other: & Error) -> bool

Implementation of ToJson for Json

Method to_json

fn to_json() -> Json

Implementation of ToJson for @Json

Method to_json

fn to_json() -> Json

Implementation of ToJson for int

Method to_json

fn to_json() -> Json

Implementation of ToJson for i8

Method to_json

fn to_json() -> Json

Implementation of ToJson for i16

Method to_json

fn to_json() -> Json

Implementation of ToJson for i32

Method to_json

fn to_json() -> Json

Implementation of ToJson for i64

Method to_json

fn to_json() -> Json

Implementation of ToJson for uint

Method to_json

fn to_json() -> Json

Implementation of ToJson for u8

Method to_json

fn to_json() -> Json

Implementation of ToJson for u16

Method to_json

fn to_json() -> Json

Implementation of ToJson for u32

Method to_json

fn to_json() -> Json

Implementation of ToJson for u64

Method to_json

fn to_json() -> Json

Implementation of ToJson for float

Method to_json

fn to_json() -> Json

Implementation of ToJson for f32

Method to_json

fn to_json() -> Json

Implementation of ToJson for f64

Method to_json

fn to_json() -> Json

Implementation of ToJson for ()

Method to_json

fn to_json() -> Json

Implementation of ToJson for bool

Method to_json

fn to_json() -> Json

Implementation of ToJson for ~str

Method to_json

fn to_json() -> Json

Implementation of ToJson for @~str

Method to_json

fn to_json() -> Json

Implementation of ToJson for (A, B)

Method to_json

fn to_json() -> Json

Implementation of ToJson for (A, B, C)

Method to_json

fn to_json() -> Json

Implementation of ToJson for ~[A]

Method to_json

fn to_json() -> Json

Implementation of ToJson for linear::LinearMap<~str, A>

Method to_json

fn to_json() -> Json

Implementation of ToJson for Option<A>

Method to_json

fn to_json() -> Json

Implementation of to_str::ToStr for Json

Method to_str

fn to_str() -> ~str

Implementation of to_str::ToStr for Error

Method to_str

fn to_str() -> ~str

Function Deserializer

fn Deserializer(rdr: io::Reader) -> Result<Deserializer, Error>

Function Parser

fn Parser(rdr: io::Reader) -> Parser

Deserializes a json value from an io::reader

Function PrettySerializer

fn PrettySerializer(wr: io::Writer) -> PrettySerializer

Function Serializer

fn Serializer(wr: io::Writer) -> Serializer

Function escape_str

fn escape_str(s: & str) -> ~str

Function from_reader

fn from_reader(rdr: io::Reader) -> Result<Json, Error>

Deserializes a json value from an io::reader

Function from_str

fn from_str(s: & str) -> Result<Json, Error>

Deserializes a json value from a string

Function spaces

fn spaces(n: uint) -> ~str

Function to_pretty_str

fn to_pretty_str(json: & Json) -> ~str

Serializes a json value into a string

Function to_pretty_writer

fn to_pretty_writer(wr: io::Writer, json: & Json)

Serializes a json value into a io::writer

Function to_str

fn to_str(json: & Json) -> ~str

Serializes a json value into a string

Function to_writer

fn to_writer(wr: io::Writer, json: & Json)

Serializes a json value into a io::writer