mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
BufWriter::into_raw_parts: Add tracking issue number
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
This commit is contained in:
parent
79c72f57d5
commit
dea6d6c909
@ -313,7 +313,7 @@ impl<W: Write> BufWriter<W> {
|
|||||||
/// assert_eq!(recovered_writer.len(), 0);
|
/// assert_eq!(recovered_writer.len(), 0);
|
||||||
/// assert_eq!(&buffered_data.unwrap(), b"ata");
|
/// assert_eq!(&buffered_data.unwrap(), b"ata");
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "bufwriter_into_raw_parts", issue = "none")]
|
#[unstable(feature = "bufwriter_into_raw_parts", issue = "80690")]
|
||||||
pub fn into_raw_parts(mut self) -> (W, Result<Vec<u8>, WriterPanicked>) {
|
pub fn into_raw_parts(mut self) -> (W, Result<Vec<u8>, WriterPanicked>) {
|
||||||
let buf = mem::take(&mut self.buf);
|
let buf = mem::take(&mut self.buf);
|
||||||
let buf = if !self.panicked { Ok(buf) } else { Err(WriterPanicked { buf }) };
|
let buf = if !self.panicked { Ok(buf) } else { Err(WriterPanicked { buf }) };
|
||||||
@ -321,7 +321,7 @@ impl<W: Write> BufWriter<W> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "bufwriter_into_raw_parts", issue = "none")]
|
#[unstable(feature = "bufwriter_into_raw_parts", issue = "80690")]
|
||||||
/// Error returned for the buffered data from `BufWriter::into_raw_parts`, when the underlying
|
/// Error returned for the buffered data from `BufWriter::into_raw_parts`, when the underlying
|
||||||
/// writer has previously panicked. Contains the (possibly partly written) buffered data.
|
/// writer has previously panicked. Contains the (possibly partly written) buffered data.
|
||||||
///
|
///
|
||||||
@ -355,7 +355,7 @@ pub struct WriterPanicked {
|
|||||||
impl WriterPanicked {
|
impl WriterPanicked {
|
||||||
/// Returns the perhaps-unwritten data. Some of this data may have been written by the
|
/// 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.
|
/// panicking call(s) to the underlying writer, so simply writing it again is not a good idea.
|
||||||
#[unstable(feature = "bufwriter_into_raw_parts", issue = "none")]
|
#[unstable(feature = "bufwriter_into_raw_parts", issue = "80690")]
|
||||||
pub fn into_inner(self) -> Vec<u8> {
|
pub fn into_inner(self) -> Vec<u8> {
|
||||||
self.buf
|
self.buf
|
||||||
}
|
}
|
||||||
@ -364,7 +364,7 @@ impl WriterPanicked {
|
|||||||
"BufWriter inner writer panicked, what data remains unwritten is not known";
|
"BufWriter inner writer panicked, what data remains unwritten is not known";
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "bufwriter_into_raw_parts", issue = "none")]
|
#[unstable(feature = "bufwriter_into_raw_parts", issue = "80690")]
|
||||||
impl error::Error for WriterPanicked {
|
impl error::Error for WriterPanicked {
|
||||||
#[allow(deprecated, deprecated_in_future)]
|
#[allow(deprecated, deprecated_in_future)]
|
||||||
fn description(&self) -> &str {
|
fn description(&self) -> &str {
|
||||||
@ -372,14 +372,14 @@ impl error::Error for WriterPanicked {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "bufwriter_into_raw_parts", issue = "none")]
|
#[unstable(feature = "bufwriter_into_raw_parts", issue = "80690")]
|
||||||
impl fmt::Display for WriterPanicked {
|
impl fmt::Display for WriterPanicked {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "{}", Self::DESCRIPTION)
|
write!(f, "{}", Self::DESCRIPTION)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "bufwriter_into_raw_parts", issue = "none")]
|
#[unstable(feature = "bufwriter_into_raw_parts", issue = "80690")]
|
||||||
impl fmt::Debug for WriterPanicked {
|
impl fmt::Debug for WriterPanicked {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
f.debug_struct("WriterPanicked")
|
f.debug_struct("WriterPanicked")
|
||||||
|
Loading…
Reference in New Issue
Block a user