1
Fork 0

Rollup merge of #72924 - JohnTitor:stabilize-buf-capacity, r=shepmaster

Stabilize `std::io::Buf{Reader, Writer}::capacity`

Closes #68833
FCP is done here: https://github.com/rust-lang/rust/issues/68833#issuecomment-637596083
This commit is contained in:
Dylan DPC 2020-06-03 18:05:41 +02:00 committed by GitHub
commit ec2826cc2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -184,7 +184,6 @@ impl<R> BufReader<R> {
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run
/// #![feature(buffered_io_capacity)]
/// use std::io::{BufReader, BufRead}; /// use std::io::{BufReader, BufRead};
/// use std::fs::File; /// use std::fs::File;
/// ///
@ -198,7 +197,7 @@ impl<R> BufReader<R> {
/// Ok(()) /// Ok(())
/// } /// }
/// ``` /// ```
#[unstable(feature = "buffered_io_capacity", issue = "68833")] #[stable(feature = "buffered_io_capacity", since = "1.46.0")]
pub fn capacity(&self) -> usize { pub fn capacity(&self) -> usize {
self.buf.len() self.buf.len()
} }
@ -609,7 +608,6 @@ impl<W: Write> BufWriter<W> {
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run
/// #![feature(buffered_io_capacity)]
/// use std::io::BufWriter; /// use std::io::BufWriter;
/// use std::net::TcpStream; /// use std::net::TcpStream;
/// ///
@ -620,7 +618,7 @@ impl<W: Write> BufWriter<W> {
/// // Calculate how many bytes can be written without flushing /// // Calculate how many bytes can be written without flushing
/// let without_flush = capacity - buf_writer.buffer().len(); /// let without_flush = capacity - buf_writer.buffer().len();
/// ``` /// ```
#[unstable(feature = "buffered_io_capacity", issue = "68833")] #[stable(feature = "buffered_io_capacity", since = "1.46.0")]
pub fn capacity(&self) -> usize { pub fn capacity(&self) -> usize {
self.buf.capacity() self.buf.capacity()
} }