File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -85,8 +85,32 @@ pin_project! {
8585 }
8686}
8787
88+ /// An error returned by `into_inner` which combines an error that
89+ /// happened while writing out the buffer, and the buffered writer object
90+ /// which may be used to recover from the condition.
91+ ///
92+ /// # Examples
93+ ///
94+ /// ```no_run
95+ /// # fn main() -> std::io::Result<()> { async_std::task::block_on(async {
96+ /// use async_std::io::BufWriter;
97+ /// use async_std::net::TcpStream;
98+ ///
99+ /// let buf_writer = BufWriter::new(TcpStream::connect("127.0.0.1:34251").await?);
100+ ///
101+ /// // unwrap the TcpStream and flush the buffer
102+ /// let stream = match buf_writer.into_inner().await {
103+ /// Ok(s) => s,
104+ /// Err(e) => {
105+ /// // Here, e is an IntoInnerError
106+ /// panic!("An error occurred");
107+ /// }
108+ /// };
109+ /// #
110+ /// # Ok(()) }) }
111+ ///```
88112#[ derive( Debug ) ]
89- pub struct IntoInnerError < W > ( W , std :: io:: Error ) ;
113+ pub struct IntoInnerError < W > ( W , crate :: io:: Error ) ;
90114
91115impl < W : Write > BufWriter < W > {
92116 /// Creates a new `BufWriter` with a default buffer capacity. The default is currently 8 KB,
Original file line number Diff line number Diff line change @@ -277,7 +277,7 @@ cfg_std! {
277277
278278 pub use buf_read:: { BufRead , Lines } ;
279279 pub use buf_reader:: BufReader ;
280- pub use buf_writer:: BufWriter ;
280+ pub use buf_writer:: { BufWriter , IntoInnerError } ;
281281 pub use copy:: copy;
282282 pub use cursor:: Cursor ;
283283 pub use empty:: { empty, Empty } ;
You can’t perform that action at this time.
0 commit comments