@@ -432,15 +432,19 @@ impl<W: Read + Write> Read for InternalBufWriter<W> {
432
432
/// infrequent calls to `read` and `write` on the underlying `Read+Write`.
433
433
///
434
434
/// The output buffer will be written out when this stream is dropped.
435
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
435
+ #[ unstable( feature = "buf_stream" ,
436
+ reason = "unsure about semantics of buffering two directions, \
437
+ leading to issues like #17136") ]
436
438
pub struct BufStream < S : Write > {
437
439
inner : BufReader < InternalBufWriter < S > >
438
440
}
439
441
442
+ #[ unstable( feature = "buf_stream" ,
443
+ reason = "unsure about semantics of buffering two directions, \
444
+ leading to issues like #17136") ]
440
445
impl < S : Read + Write > BufStream < S > {
441
446
/// Creates a new buffered stream with explicitly listed capacities for the
442
447
/// reader/writer buffer.
443
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
444
448
pub fn with_capacities ( reader_cap : usize , writer_cap : usize , inner : S )
445
449
-> BufStream < S > {
446
450
let writer = BufWriter :: with_capacity ( writer_cap, inner) ;
@@ -451,13 +455,11 @@ impl<S: Read + Write> BufStream<S> {
451
455
452
456
/// Creates a new buffered stream with the default reader/writer buffer
453
457
/// capacities.
454
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
455
458
pub fn new ( inner : S ) -> BufStream < S > {
456
459
BufStream :: with_capacities ( DEFAULT_BUF_SIZE , DEFAULT_BUF_SIZE , inner)
457
460
}
458
461
459
462
/// Gets a reference to the underlying stream.
460
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
461
463
pub fn get_ref ( & self ) -> & S {
462
464
let InternalBufWriter ( ref w) = self . inner . inner ;
463
465
w. get_ref ( )
@@ -469,7 +471,6 @@ impl<S: Read + Write> BufStream<S> {
469
471
///
470
472
/// It is inadvisable to read directly from or write directly to the
471
473
/// underlying stream.
472
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
473
474
pub fn get_mut ( & mut self ) -> & mut S {
474
475
let InternalBufWriter ( ref mut w) = self . inner . inner ;
475
476
w. get_mut ( )
@@ -479,7 +480,6 @@ impl<S: Read + Write> BufStream<S> {
479
480
///
480
481
/// The internal write buffer is written out before returning the stream.
481
482
/// Any leftover data in the read buffer is lost.
482
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
483
483
pub fn into_inner ( self ) -> Result < S , IntoInnerError < BufStream < S > > > {
484
484
let BufReader { inner : InternalBufWriter ( w) , buf, pos, cap } = self . inner ;
485
485
w. into_inner ( ) . map_err ( |IntoInnerError ( w, e) | {
@@ -490,20 +490,26 @@ impl<S: Read + Write> BufStream<S> {
490
490
}
491
491
}
492
492
493
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
493
+ #[ unstable( feature = "buf_stream" ,
494
+ reason = "unsure about semantics of buffering two directions, \
495
+ leading to issues like #17136") ]
494
496
impl < S : Read + Write > BufRead for BufStream < S > {
495
497
fn fill_buf ( & mut self ) -> io:: Result < & [ u8 ] > { self . inner . fill_buf ( ) }
496
498
fn consume ( & mut self , amt : usize ) { self . inner . consume ( amt) }
497
499
}
498
500
499
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
501
+ #[ unstable( feature = "buf_stream" ,
502
+ reason = "unsure about semantics of buffering two directions, \
503
+ leading to issues like #17136") ]
500
504
impl < S : Read + Write > Read for BufStream < S > {
501
505
fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
502
506
self . inner . read ( buf)
503
507
}
504
508
}
505
509
506
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
510
+ #[ unstable( feature = "buf_stream" ,
511
+ reason = "unsure about semantics of buffering two directions, \
512
+ leading to issues like #17136") ]
507
513
impl < S : Read + Write > Write for BufStream < S > {
508
514
fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
509
515
self . inner . inner . get_mut ( ) . write ( buf)
@@ -513,7 +519,9 @@ impl<S: Read + Write> Write for BufStream<S> {
513
519
}
514
520
}
515
521
516
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
522
+ #[ unstable( feature = "buf_stream" ,
523
+ reason = "unsure about semantics of buffering two directions, \
524
+ leading to issues like #17136") ]
517
525
impl < S : Write > fmt:: Debug for BufStream < S > where S : fmt:: Debug {
518
526
fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
519
527
let reader = & self . inner ;
0 commit comments