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