@@ -130,19 +130,13 @@ impl serialize::Encoder for Encoder {
130
130
f ( ) ;
131
131
}
132
132
133
- fn emit_borrowed_vec ( & self , _len : uint , f : & fn ( ) ) {
133
+ fn emit_seq ( & self , _len : uint , f : & fn ( ) ) {
134
134
self . wr . write_char ( '[' ) ;
135
135
f ( ) ;
136
136
self . wr . write_char ( ']' ) ;
137
137
}
138
138
139
- fn emit_owned_vec ( & self , len : uint , f : & fn ( ) ) {
140
- self . emit_borrowed_vec ( len, f)
141
- }
142
- fn emit_managed_vec ( & self , len : uint , f : & fn ( ) ) {
143
- self . emit_borrowed_vec ( len, f)
144
- }
145
- fn emit_vec_elt ( & self , idx : uint , f : & fn ( ) ) {
139
+ fn emit_seq_elt ( & self , idx : uint , f : & fn ( ) ) {
146
140
if idx != 0 { self . wr . write_char ( ',' ) ; }
147
141
f ( )
148
142
}
@@ -165,10 +159,10 @@ impl serialize::Encoder for Encoder {
165
159
}
166
160
167
161
fn emit_tup ( & self , len : uint , f : & fn ( ) ) {
168
- self . emit_borrowed_vec ( len, f) ;
162
+ self . emit_seq ( len, f) ;
169
163
}
170
164
fn emit_tup_elt ( & self , idx : uint , f : & fn ( ) ) {
171
- self . emit_vec_elt ( idx, f)
165
+ self . emit_seq_elt ( idx, f)
172
166
}
173
167
174
168
fn emit_option ( & self , f : & fn ( ) ) { f ( ) ; }
@@ -243,7 +237,7 @@ impl serialize::Encoder for PrettyEncoder {
243
237
f ( )
244
238
}
245
239
246
- fn emit_borrowed_vec ( & self , len : uint , f : & fn ( ) ) {
240
+ fn emit_seq ( & self , len : uint , f : & fn ( ) ) {
247
241
if len == 0 {
248
242
self . wr . write_str ( "[]" ) ;
249
243
} else {
@@ -256,13 +250,7 @@ impl serialize::Encoder for PrettyEncoder {
256
250
self . wr . write_char ( ']' ) ;
257
251
}
258
252
}
259
- fn emit_owned_vec ( & self , len : uint , f : & fn ( ) ) {
260
- self . emit_borrowed_vec ( len, f)
261
- }
262
- fn emit_managed_vec ( & self , len : uint , f : & fn ( ) ) {
263
- self . emit_borrowed_vec ( len, f)
264
- }
265
- fn emit_vec_elt ( & self , idx : uint , f : & fn ( ) ) {
253
+ fn emit_seq_elt ( & self , idx : uint , f : & fn ( ) ) {
266
254
if idx == 0 {
267
255
self . wr . write_char ( '\n' ) ;
268
256
} else {
@@ -300,10 +288,10 @@ impl serialize::Encoder for PrettyEncoder {
300
288
f ( ) ;
301
289
}
302
290
fn emit_tup ( & self , sz : uint , f : & fn ( ) ) {
303
- self . emit_borrowed_vec ( sz, f) ;
291
+ self . emit_seq ( sz, f) ;
304
292
}
305
293
fn emit_tup_elt ( & self , idx : uint , f : & fn ( ) ) {
306
- self . emit_vec_elt ( idx, f)
294
+ self . emit_seq_elt ( idx, f)
307
295
}
308
296
309
297
fn emit_option ( & self , f : & fn ( ) ) { f ( ) ; }
@@ -858,19 +846,8 @@ impl<'self> serialize::Decoder for Decoder<'self> {
858
846
}
859
847
}
860
848
861
- fn read_owned_vec<T>(&self, f: &fn(uint) -> T) -> T {
862
- debug!(" read_owned_vec( ) ");
863
- let len = match *self.peek() {
864
- List(ref list) => list.len(),
865
- _ => fail!(~" not a list"),
866
- };
867
- let res = f(len);
868
- self.pop();
869
- res
870
- }
871
-
872
- fn read_managed_vec<T>(&self, f: &fn(uint) -> T) -> T {
873
- debug!(" read_owned_vec( ) ");
849
+ fn read_seq<T>(&self, f: &fn(uint) -> T) -> T {
850
+ debug!(" read_seq( ) ");
874
851
let len = match *self.peek() {
875
852
List(ref list) => list.len(),
876
853
_ => fail!(~" not a list"),
@@ -880,8 +857,8 @@ impl<'self> serialize::Decoder for Decoder<'self> {
880
857
res
881
858
}
882
859
883
- fn read_vec_elt <T>(&self, idx: uint, f: &fn() -> T) -> T {
884
- debug!(" read_vec_elt ( idx=%u) ", idx);
860
+ fn read_seq_elt <T>(&self, idx: uint, f: &fn() -> T) -> T {
861
+ debug!(" read_seq_elt ( idx=%u) ", idx);
885
862
match *self.peek() {
886
863
List(ref list) => {
887
864
self.stack.push(&list[idx]);
0 commit comments