std: remove Encoder::emit_tup{,_elt} and Decoder::read_tup{,_elt}
This commit is contained in:
parent
590bbcebe9
commit
e99cdcfba8
4 changed files with 0 additions and 57 deletions
|
@ -378,16 +378,6 @@ pub mod reader {
|
||||||
f()
|
f()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_tup<T>(&self, len: uint, f: &fn() -> T) -> T {
|
|
||||||
debug!("read_tup(len=%u)", len);
|
|
||||||
f()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn read_tup_elt<T>(&self, idx: uint, f: &fn() -> T) -> T {
|
|
||||||
debug!("read_tup_elt(idx=%u)", idx);
|
|
||||||
f()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(stage0)]
|
#[cfg(stage0)]
|
||||||
fn read_option<T>(&self, f: &fn(bool) -> T) -> T {
|
fn read_option<T>(&self, f: &fn(bool) -> T) -> T {
|
||||||
debug!("read_option()");
|
debug!("read_option()");
|
||||||
|
@ -661,9 +651,6 @@ pub mod writer {
|
||||||
f()
|
f()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn emit_tup(&self, _len: uint, f: &fn()) { f() }
|
|
||||||
fn emit_tup_elt(&self, _idx: uint, f: &fn()) { f() }
|
|
||||||
|
|
||||||
fn emit_option(&self, f: &fn()) {
|
fn emit_option(&self, f: &fn()) {
|
||||||
self.emit_enum("Option", f);
|
self.emit_enum("Option", f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,13 +158,6 @@ impl serialize::Encoder for Encoder {
|
||||||
f();
|
f();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn emit_tup(&self, len: uint, f: &fn()) {
|
|
||||||
self.emit_seq(len, f);
|
|
||||||
}
|
|
||||||
fn emit_tup_elt(&self, idx: uint, f: &fn()) {
|
|
||||||
self.emit_seq_elt(idx, f)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn emit_option(&self, f: &fn()) { f(); }
|
fn emit_option(&self, f: &fn()) { f(); }
|
||||||
fn emit_option_none(&self) { self.emit_nil(); }
|
fn emit_option_none(&self) { self.emit_nil(); }
|
||||||
fn emit_option_some(&self, f: &fn()) { f(); }
|
fn emit_option_some(&self, f: &fn()) { f(); }
|
||||||
|
@ -287,12 +280,6 @@ impl serialize::Encoder for PrettyEncoder {
|
||||||
self.wr.write_str(": ");
|
self.wr.write_str(": ");
|
||||||
f();
|
f();
|
||||||
}
|
}
|
||||||
fn emit_tup(&self, sz: uint, f: &fn()) {
|
|
||||||
self.emit_seq(sz, f);
|
|
||||||
}
|
|
||||||
fn emit_tup_elt(&self, idx: uint, f: &fn()) {
|
|
||||||
self.emit_seq_elt(idx, f)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn emit_option(&self, f: &fn()) { f(); }
|
fn emit_option(&self, f: &fn()) { f(); }
|
||||||
fn emit_option_none(&self) { self.emit_nil(); }
|
fn emit_option_none(&self) { self.emit_nil(); }
|
||||||
|
@ -905,24 +892,6 @@ impl<'self> serialize::Decoder for Decoder<'self> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_tup<T>(&self, len: uint, f: &fn() -> T) -> T {
|
|
||||||
debug!("read_tup(len=%u)", len);
|
|
||||||
let value = f();
|
|
||||||
self.pop();
|
|
||||||
value
|
|
||||||
}
|
|
||||||
|
|
||||||
fn read_tup_elt<T>(&self, idx: uint, f: &fn() -> T) -> T {
|
|
||||||
debug!("read_tup_elt(idx=%u)", idx);
|
|
||||||
match *self.peek() {
|
|
||||||
List(ref list) => {
|
|
||||||
self.stack.push(&list[idx]);
|
|
||||||
f()
|
|
||||||
}
|
|
||||||
_ => fail!(~"not a list")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn read_option<T>(&self, f: &fn(bool) -> T) -> T {
|
fn read_option<T>(&self, f: &fn(bool) -> T) -> T {
|
||||||
match *self.peek() {
|
match *self.peek() {
|
||||||
Null => { self.pop(); f(false) }
|
Null => { self.pop(); f(false) }
|
||||||
|
|
|
@ -53,9 +53,6 @@ pub trait Encoder {
|
||||||
fn emit_struct(&self, name: &str, _len: uint, f: &fn());
|
fn emit_struct(&self, name: &str, _len: uint, f: &fn());
|
||||||
fn emit_field(&self, f_name: &str, f_idx: uint, f: &fn());
|
fn emit_field(&self, f_name: &str, f_idx: uint, f: &fn());
|
||||||
|
|
||||||
fn emit_tup(&self, len: uint, f: &fn());
|
|
||||||
fn emit_tup_elt(&self, idx: uint, f: &fn());
|
|
||||||
|
|
||||||
// Specialized types:
|
// Specialized types:
|
||||||
fn emit_option(&self, f: &fn());
|
fn emit_option(&self, f: &fn());
|
||||||
fn emit_option_none(&self);
|
fn emit_option_none(&self);
|
||||||
|
@ -99,9 +96,6 @@ pub trait Decoder {
|
||||||
fn read_struct<T>(&self, name: &str, _len: uint, f: &fn() -> T) -> T;
|
fn read_struct<T>(&self, name: &str, _len: uint, f: &fn() -> T) -> T;
|
||||||
fn read_field<T>(&self, name: &str, idx: uint, f: &fn() -> T) -> T;
|
fn read_field<T>(&self, name: &str, idx: uint, f: &fn() -> T) -> T;
|
||||||
|
|
||||||
fn read_tup<T>(&self, sz: uint, f: &fn() -> T) -> T;
|
|
||||||
fn read_tup_elt<T>(&self, idx: uint, f: &fn() -> T) -> T;
|
|
||||||
|
|
||||||
// Specialized types:
|
// Specialized types:
|
||||||
fn read_option<T>(&self, f: &fn(bool) -> T) -> T;
|
fn read_option<T>(&self, f: &fn(bool) -> T) -> T;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1272,13 +1272,6 @@ mod test {
|
||||||
self.add_to_log(CallToEmitField (name.to_str(),idx)); f();
|
self.add_to_log(CallToEmitField (name.to_str(),idx)); f();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn emit_tup(&self, +_len: uint, f: &fn()) {
|
|
||||||
self.add_unknown_to_log(); f();
|
|
||||||
}
|
|
||||||
fn emit_tup_elt(&self, +_idx: uint, f: &fn()) {
|
|
||||||
self.add_unknown_to_log(); f();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn emit_option(&self, f: &fn()) {
|
fn emit_option(&self, f: &fn()) {
|
||||||
self.add_to_log(CallToEmitOption);
|
self.add_to_log(CallToEmitOption);
|
||||||
f();
|
f();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue