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