mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Rename feature gate bufwriter_into_parts from bufwriter_into_raw_parts
As requested https://github.com/rust-lang/rust/pull/85901#pullrequestreview-698404772 Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
This commit is contained in:
parent
66f38075af
commit
bf30c51541
@ -323,7 +323,7 @@ impl<W: Write> BufWriter<W> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(bufwriter_into_raw_parts)]
|
||||
/// #![feature(bufwriter_into_parts)]
|
||||
/// use std::io::{BufWriter, Write};
|
||||
///
|
||||
/// let mut buffer = [0u8; 10];
|
||||
@ -334,7 +334,7 @@ impl<W: Write> BufWriter<W> {
|
||||
/// assert_eq!(recovered_writer.len(), 0);
|
||||
/// assert_eq!(&buffered_data.unwrap(), b"ata");
|
||||
/// ```
|
||||
#[unstable(feature = "bufwriter_into_raw_parts", issue = "80690")]
|
||||
#[unstable(feature = "bufwriter_into_parts", issue = "80690")]
|
||||
pub fn into_parts(mut self) -> (W, Result<Vec<u8>, WriterPanicked>) {
|
||||
let buf = mem::take(&mut self.buf);
|
||||
let buf = if !self.panicked { Ok(buf) } else { Err(WriterPanicked { buf }) };
|
||||
@ -444,14 +444,14 @@ impl<W: Write> BufWriter<W> {
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "bufwriter_into_raw_parts", issue = "80690")]
|
||||
#[unstable(feature = "bufwriter_into_parts", issue = "80690")]
|
||||
/// Error returned for the buffered data from `BufWriter::into_parts`, when the underlying
|
||||
/// writer has previously panicked. Contains the (possibly partly written) buffered data.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(bufwriter_into_raw_parts)]
|
||||
/// #![feature(bufwriter_into_parts)]
|
||||
/// use std::io::{self, BufWriter, Write};
|
||||
/// use std::panic::{catch_unwind, AssertUnwindSafe};
|
||||
///
|
||||
@ -478,7 +478,7 @@ pub struct WriterPanicked {
|
||||
impl WriterPanicked {
|
||||
/// Returns the perhaps-unwritten data. Some of this data may have been written by the
|
||||
/// panicking call(s) to the underlying writer, so simply writing it again is not a good idea.
|
||||
#[unstable(feature = "bufwriter_into_raw_parts", issue = "80690")]
|
||||
#[unstable(feature = "bufwriter_into_parts", issue = "80690")]
|
||||
pub fn into_inner(self) -> Vec<u8> {
|
||||
self.buf
|
||||
}
|
||||
@ -487,7 +487,7 @@ impl WriterPanicked {
|
||||
"BufWriter inner writer panicked, what data remains unwritten is not known";
|
||||
}
|
||||
|
||||
#[unstable(feature = "bufwriter_into_raw_parts", issue = "80690")]
|
||||
#[unstable(feature = "bufwriter_into_parts", issue = "80690")]
|
||||
impl error::Error for WriterPanicked {
|
||||
#[allow(deprecated, deprecated_in_future)]
|
||||
fn description(&self) -> &str {
|
||||
@ -495,14 +495,14 @@ impl error::Error for WriterPanicked {
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "bufwriter_into_raw_parts", issue = "80690")]
|
||||
#[unstable(feature = "bufwriter_into_parts", issue = "80690")]
|
||||
impl fmt::Display for WriterPanicked {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", Self::DESCRIPTION)
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "bufwriter_into_raw_parts", issue = "80690")]
|
||||
#[unstable(feature = "bufwriter_into_parts", issue = "80690")]
|
||||
impl fmt::Debug for WriterPanicked {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("WriterPanicked")
|
||||
|
@ -14,7 +14,7 @@ use crate::io::Error;
|
||||
|
||||
pub use bufreader::BufReader;
|
||||
pub use bufwriter::BufWriter;
|
||||
#[unstable(feature = "bufwriter_into_raw_parts", issue = "80690")]
|
||||
#[unstable(feature = "bufwriter_into_parts", issue = "80690")]
|
||||
pub use bufwriter::WriterPanicked;
|
||||
pub use linewriter::LineWriter;
|
||||
use linewritershim::LineWriterShim;
|
||||
|
@ -264,7 +264,7 @@ use crate::sys_common::memchr;
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::buffered::IntoInnerError;
|
||||
#[unstable(feature = "bufwriter_into_raw_parts", issue = "80690")]
|
||||
#[unstable(feature = "bufwriter_into_parts", issue = "80690")]
|
||||
pub use self::buffered::WriterPanicked;
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub use self::buffered::{BufReader, BufWriter, LineWriter};
|
||||
|
Loading…
Reference in New Issue
Block a user