@@ -318,24 +318,24 @@ impl<W: Write> BufWriter<W> {
318
318
/// In this case, we return `WriterPanicked` for the buffered data (from which the buffer
319
319
/// contents can still be recovered).
320
320
///
321
- /// `into_raw_parts ` makes no attempt to flush data and cannot fail.
321
+ /// `into_parts ` makes no attempt to flush data and cannot fail.
322
322
///
323
323
/// # Examples
324
324
///
325
325
/// ```
326
- /// #![feature(bufwriter_into_raw_parts )]
326
+ /// #![feature(bufwriter_into_parts )]
327
327
/// use std::io::{BufWriter, Write};
328
328
///
329
329
/// let mut buffer = [0u8; 10];
330
330
/// let mut stream = BufWriter::new(buffer.as_mut());
331
331
/// write!(stream, "too much data").unwrap();
332
332
/// stream.flush().expect_err("it doesn't fit");
333
- /// let (recovered_writer, buffered_data) = stream.into_raw_parts ();
333
+ /// let (recovered_writer, buffered_data) = stream.into_parts ();
334
334
/// assert_eq!(recovered_writer.len(), 0);
335
335
/// assert_eq!(&buffered_data.unwrap(), b"ata");
336
336
/// ```
337
- #[ unstable( feature = "bufwriter_into_raw_parts " , issue = "80690" ) ]
338
- pub fn into_raw_parts ( mut self ) -> ( W , Result < Vec < u8 > , WriterPanicked > ) {
337
+ #[ unstable( feature = "bufwriter_into_parts " , issue = "80690" ) ]
338
+ pub fn into_parts ( mut self ) -> ( W , Result < Vec < u8 > , WriterPanicked > ) {
339
339
let buf = mem:: take ( & mut self . buf ) ;
340
340
let buf = if !self . panicked { Ok ( buf) } else { Err ( WriterPanicked { buf } ) } ;
341
341
@@ -444,14 +444,14 @@ impl<W: Write> BufWriter<W> {
444
444
}
445
445
}
446
446
447
- #[ unstable( feature = "bufwriter_into_raw_parts " , issue = "80690" ) ]
448
- /// Error returned for the buffered data from `BufWriter::into_raw_parts `, when the underlying
447
+ #[ unstable( feature = "bufwriter_into_parts " , issue = "80690" ) ]
448
+ /// Error returned for the buffered data from `BufWriter::into_parts `, when the underlying
449
449
/// writer has previously panicked. Contains the (possibly partly written) buffered data.
450
450
///
451
451
/// # Example
452
452
///
453
453
/// ```
454
- /// #![feature(bufwriter_into_raw_parts )]
454
+ /// #![feature(bufwriter_into_parts )]
455
455
/// use std::io::{self, BufWriter, Write};
456
456
/// use std::panic::{catch_unwind, AssertUnwindSafe};
457
457
///
@@ -467,7 +467,7 @@ impl<W: Write> BufWriter<W> {
467
467
/// stream.flush().unwrap()
468
468
/// }));
469
469
/// assert!(result.is_err());
470
- /// let (recovered_writer, buffered_data) = stream.into_raw_parts ();
470
+ /// let (recovered_writer, buffered_data) = stream.into_parts ();
471
471
/// assert!(matches!(recovered_writer, PanickingWriter));
472
472
/// assert_eq!(buffered_data.unwrap_err().into_inner(), b"some data");
473
473
/// ```
@@ -478,7 +478,7 @@ pub struct WriterPanicked {
478
478
impl WriterPanicked {
479
479
/// Returns the perhaps-unwritten data. Some of this data may have been written by the
480
480
/// panicking call(s) to the underlying writer, so simply writing it again is not a good idea.
481
- #[ unstable( feature = "bufwriter_into_raw_parts " , issue = "80690" ) ]
481
+ #[ unstable( feature = "bufwriter_into_parts " , issue = "80690" ) ]
482
482
pub fn into_inner ( self ) -> Vec < u8 > {
483
483
self . buf
484
484
}
@@ -487,22 +487,22 @@ impl WriterPanicked {
487
487
"BufWriter inner writer panicked, what data remains unwritten is not known" ;
488
488
}
489
489
490
- #[ unstable( feature = "bufwriter_into_raw_parts " , issue = "80690" ) ]
490
+ #[ unstable( feature = "bufwriter_into_parts " , issue = "80690" ) ]
491
491
impl error:: Error for WriterPanicked {
492
492
#[ allow( deprecated, deprecated_in_future) ]
493
493
fn description ( & self ) -> & str {
494
494
Self :: DESCRIPTION
495
495
}
496
496
}
497
497
498
- #[ unstable( feature = "bufwriter_into_raw_parts " , issue = "80690" ) ]
498
+ #[ unstable( feature = "bufwriter_into_parts " , issue = "80690" ) ]
499
499
impl fmt:: Display for WriterPanicked {
500
500
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
501
501
write ! ( f, "{}" , Self :: DESCRIPTION )
502
502
}
503
503
}
504
504
505
- #[ unstable( feature = "bufwriter_into_raw_parts " , issue = "80690" ) ]
505
+ #[ unstable( feature = "bufwriter_into_parts " , issue = "80690" ) ]
506
506
impl fmt:: Debug for WriterPanicked {
507
507
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
508
508
f. debug_struct ( "WriterPanicked" )
0 commit comments