libstd: Remove some residual mutable fields

This commit is contained in:
Patrick Walton 2013-05-03 17:55:53 -07:00
parent d12d25534b
commit c7522417d4
2 changed files with 34 additions and 1 deletions

View File

@ -600,11 +600,18 @@ pub mod writer {
use core::vec;
// ebml writing
#[cfg(stage0)]
pub struct Encoder {
writer: @io::Writer,
priv mut size_positions: ~[uint],
}
#[cfg(not(stage0))]
pub struct Encoder {
writer: @io::Writer,
priv size_positions: ~[uint],
}
fn write_sized_vuint(w: @io::Writer, n: uint, size: uint) {
match size {
1u => w.write(&[0x80u8 | (n as u8)]),
@ -625,9 +632,22 @@ pub mod writer {
fail!(fmt!("vint to write too big: %?", n));
}
#[cfg(stage0)]
pub fn Encoder(w: @io::Writer) -> Encoder {
let size_positions: ~[uint] = ~[];
Encoder { writer: w, mut size_positions: size_positions }
Encoder {
writer: w,
mut size_positions: size_positions
}
}
#[cfg(not(stage0))]
pub fn Encoder(w: @io::Writer) -> Encoder {
let size_positions: ~[uint] = ~[];
Encoder {
writer: w,
size_positions: size_positions
}
}
// FIXME (#2741): Provide a function to write the standard ebml header.

View File

@ -220,11 +220,18 @@ impl serialize::Encoder for Encoder {
}
}
#[cfg(stage0)]
pub struct PrettyEncoder {
priv wr: @io::Writer,
priv mut indent: uint,
}
#[cfg(not(stage0))]
pub struct PrettyEncoder {
priv wr: @io::Writer,
priv indent: uint,
}
pub fn PrettyEncoder(wr: @io::Writer) -> PrettyEncoder {
PrettyEncoder {
wr: wr,
@ -838,10 +845,16 @@ pub fn from_str(s: &str) -> Result<Json, Error> {
}
}
#[cfg(stage0)]
pub struct Decoder {
priv mut stack: ~[Json],
}
#[cfg(not(stage0))]
pub struct Decoder {
priv stack: ~[Json],
}
pub fn Decoder(json: Json) -> Decoder {
Decoder {
stack: ~[json]