@@ -284,14 +284,8 @@ impl writer {
284
284
self . wr_tagged_bytes ( tag_id, & [ v as u8 ] ) ;
285
285
}
286
286
287
- fn wr_tagged_str ( tag_id : uint , v : ~str ) {
288
- // Lame: can't use str::as_bytes() here because the resulting
289
- // vector is NULL-terminated. Annoyingly, the underlying
290
- // writer interface doesn't permit us to write a slice of a
291
- // vector. We need first-class slices, I think.
292
-
293
- // str::as_bytes(v) {|b| self.wr_tagged_bytes(tag_id, b); }
294
- self . wr_tagged_bytes ( tag_id, str:: bytes ( v) ) ;
287
+ fn wr_tagged_str ( tag_id : uint , v : & str ) {
288
+ str:: byte_slice ( v, |b| self . wr_tagged_bytes ( tag_id, b) ) ;
295
289
}
296
290
297
291
fn wr_bytes ( b : & [ u8 ] ) {
@@ -369,7 +363,7 @@ impl ebml::writer: serialization::serializer {
369
363
fn emit_f32 ( _v : f32 ) { fail ~"Unimplemented : serializing an f32"; }
370
364
fn emit_float ( _v : float ) { fail ~"Unimplemented : serializing a float"; }
371
365
372
- fn emit_str ( v : ~ str ) { self . wr_tagged_str ( es_str as uint , v) }
366
+ fn emit_str ( v : & str ) { self . wr_tagged_str ( es_str as uint , v) }
373
367
374
368
fn emit_enum ( name : ~str , f : fn ( ) ) {
375
369
self . _emit_label ( name) ;
@@ -451,7 +445,7 @@ priv impl ebml_deserializer {
451
445
return r_doc;
452
446
}
453
447
454
- fn push_doc < T : copy > ( d : ebml:: doc , f : fn ( ) -> T ) -> T {
448
+ fn push_doc < T > ( d : ebml:: doc , f : fn ( ) -> T ) -> T {
455
449
let old_parent = self . parent ;
456
450
let old_pos = self . pos ;
457
451
self . parent = d;
@@ -505,13 +499,13 @@ impl ebml_deserializer: serialization::deserializer {
505
499
fn read_str ( ) -> ~str { ebml:: doc_as_str ( self . next_doc ( es_str) ) }
506
500
507
501
// Compound types:
508
- fn read_enum < T : copy > ( name : ~str , f : fn ( ) -> T ) -> T {
502
+ fn read_enum < T > ( name : ~str , f : fn ( ) -> T ) -> T {
509
503
debug ! { "read_enum(%s)" , name} ;
510
504
self . _check_label ( name) ;
511
505
self . push_doc ( self . next_doc ( es_enum) , f)
512
506
}
513
507
514
- fn read_enum_variant < T : copy > ( f : fn ( uint ) -> T ) -> T {
508
+ fn read_enum_variant < T > ( f : fn ( uint ) -> T ) -> T {
515
509
debug ! { "read_enum_variant()" } ;
516
510
let idx = self . _next_uint ( es_enum_vid) ;
517
511
debug ! { " idx=%u" , idx} ;
@@ -520,12 +514,12 @@ impl ebml_deserializer: serialization::deserializer {
520
514
}
521
515
}
522
516
523
- fn read_enum_variant_arg < T : copy > ( idx : uint , f : fn ( ) -> T ) -> T {
517
+ fn read_enum_variant_arg < T > ( idx : uint , f : fn ( ) -> T ) -> T {
524
518
debug ! { "read_enum_variant_arg(idx=%u)" , idx} ;
525
519
f ( )
526
520
}
527
521
528
- fn read_vec < T : copy > ( f : fn ( uint ) -> T ) -> T {
522
+ fn read_vec < T > ( f : fn ( uint ) -> T ) -> T {
529
523
debug ! { "read_vec()" } ;
530
524
do self. push_doc ( self . next_doc ( es_vec) ) {
531
525
let len = self . _next_uint ( es_vec_len) ;
@@ -534,38 +528,38 @@ impl ebml_deserializer: serialization::deserializer {
534
528
}
535
529
}
536
530
537
- fn read_vec_elt < T : copy > ( idx : uint , f : fn ( ) -> T ) -> T {
531
+ fn read_vec_elt < T > ( idx : uint , f : fn ( ) -> T ) -> T {
538
532
debug ! { "read_vec_elt(idx=%u)" , idx} ;
539
533
self . push_doc ( self . next_doc ( es_vec_elt) , f)
540
534
}
541
535
542
- fn read_box < T : copy > ( f : fn ( ) -> T ) -> T {
536
+ fn read_box < T > ( f : fn ( ) -> T ) -> T {
543
537
debug ! { "read_box()" } ;
544
538
f ( )
545
539
}
546
540
547
- fn read_uniq < T : copy > ( f : fn ( ) -> T ) -> T {
541
+ fn read_uniq < T > ( f : fn ( ) -> T ) -> T {
548
542
debug ! { "read_uniq()" } ;
549
543
f ( )
550
544
}
551
545
552
- fn read_rec < T : copy > ( f : fn ( ) -> T ) -> T {
546
+ fn read_rec < T > ( f : fn ( ) -> T ) -> T {
553
547
debug ! { "read_rec()" } ;
554
548
f ( )
555
549
}
556
550
557
- fn read_rec_field < T : copy > ( f_name : ~str , f_idx : uint , f : fn ( ) -> T ) -> T {
551
+ fn read_rec_field < T > ( f_name : ~str , f_idx : uint , f : fn ( ) -> T ) -> T {
558
552
debug ! { "read_rec_field(%s, idx=%u)" , f_name, f_idx} ;
559
553
self . _check_label ( f_name) ;
560
554
f ( )
561
555
}
562
556
563
- fn read_tup < T : copy > ( sz : uint , f : fn ( ) -> T ) -> T {
557
+ fn read_tup < T > ( sz : uint , f : fn ( ) -> T ) -> T {
564
558
debug ! { "read_tup(sz=%u)" , sz} ;
565
559
f ( )
566
560
}
567
561
568
- fn read_tup_elt < T : copy > ( idx : uint , f : fn ( ) -> T ) -> T {
562
+ fn read_tup_elt < T > ( idx : uint , f : fn ( ) -> T ) -> T {
569
563
debug ! { "read_tup_elt(idx=%u)" , idx} ;
570
564
f ( )
571
565
}
0 commit comments