serialize: Switch field privacy as necessary
This commit is contained in:
parent
e5a49a2fcf
commit
ee7016d95f
2 changed files with 19 additions and 19 deletions
|
@ -20,9 +20,9 @@ use std::str;
|
||||||
// Common data structures
|
// Common data structures
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct Doc<'a> {
|
pub struct Doc<'a> {
|
||||||
data: &'a [u8],
|
pub data: &'a [u8],
|
||||||
start: uint,
|
pub start: uint,
|
||||||
end: uint,
|
pub end: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'doc> Doc<'doc> {
|
impl<'doc> Doc<'doc> {
|
||||||
|
@ -40,8 +40,8 @@ impl<'doc> Doc<'doc> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct TaggedDoc<'a> {
|
pub struct TaggedDoc<'a> {
|
||||||
priv tag: uint,
|
tag: uint,
|
||||||
doc: Doc<'a>,
|
pub doc: Doc<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum EbmlEncoderTag {
|
pub enum EbmlEncoderTag {
|
||||||
|
@ -117,8 +117,8 @@ pub mod reader {
|
||||||
)
|
)
|
||||||
|
|
||||||
pub struct Res {
|
pub struct Res {
|
||||||
val: uint,
|
pub val: uint,
|
||||||
next: uint
|
pub next: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
|
@ -291,8 +291,8 @@ pub mod reader {
|
||||||
pub fn doc_as_i64(d: Doc) -> i64 { doc_as_u64(d) as i64 }
|
pub fn doc_as_i64(d: Doc) -> i64 { doc_as_u64(d) as i64 }
|
||||||
|
|
||||||
pub struct Decoder<'a> {
|
pub struct Decoder<'a> {
|
||||||
priv parent: Doc<'a>,
|
parent: Doc<'a>,
|
||||||
priv pos: uint,
|
pos: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn Decoder<'a>(d: Doc<'a>) -> Decoder<'a> {
|
pub fn Decoder<'a>(d: Doc<'a>) -> Decoder<'a> {
|
||||||
|
@ -635,8 +635,8 @@ pub mod writer {
|
||||||
|
|
||||||
// ebml writing
|
// ebml writing
|
||||||
pub struct Encoder<'a, W> {
|
pub struct Encoder<'a, W> {
|
||||||
writer: &'a mut W,
|
pub writer: &'a mut W,
|
||||||
priv size_positions: ~[uint],
|
size_positions: ~[uint],
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_sized_vuint<W: Writer>(w: &mut W, n: uint, size: uint) -> EncodeResult {
|
fn write_sized_vuint<W: Writer>(w: &mut W, n: uint, size: uint) -> EncodeResult {
|
||||||
|
|
|
@ -298,7 +298,7 @@ fn spaces(n: uint) -> ~str {
|
||||||
|
|
||||||
/// A structure for implementing serialization to JSON.
|
/// A structure for implementing serialization to JSON.
|
||||||
pub struct Encoder<'a> {
|
pub struct Encoder<'a> {
|
||||||
priv wr: &'a mut io::Writer,
|
wr: &'a mut io::Writer,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Encoder<'a> {
|
impl<'a> Encoder<'a> {
|
||||||
|
@ -504,8 +504,8 @@ impl<'a> ::Encoder<io::IoError> for Encoder<'a> {
|
||||||
/// Another encoder for JSON, but prints out human-readable JSON instead of
|
/// Another encoder for JSON, but prints out human-readable JSON instead of
|
||||||
/// compact data
|
/// compact data
|
||||||
pub struct PrettyEncoder<'a> {
|
pub struct PrettyEncoder<'a> {
|
||||||
priv wr: &'a mut io::Writer,
|
wr: &'a mut io::Writer,
|
||||||
priv indent: uint,
|
indent: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PrettyEncoder<'a> {
|
impl<'a> PrettyEncoder<'a> {
|
||||||
|
@ -899,10 +899,10 @@ impl Json {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Parser<T> {
|
pub struct Parser<T> {
|
||||||
priv rdr: T,
|
rdr: T,
|
||||||
priv ch: Option<char>,
|
ch: Option<char>,
|
||||||
priv line: uint,
|
line: uint,
|
||||||
priv col: uint,
|
col: uint,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Iterator<char>> Parser<T> {
|
impl<T: Iterator<char>> Parser<T> {
|
||||||
|
@ -1298,7 +1298,7 @@ pub fn from_str(s: &str) -> DecodeResult<Json> {
|
||||||
|
|
||||||
/// A structure to decode JSON to values in rust.
|
/// A structure to decode JSON to values in rust.
|
||||||
pub struct Decoder {
|
pub struct Decoder {
|
||||||
priv stack: ~[Json],
|
stack: ~[Json],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Decoder {
|
impl Decoder {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue