|
1 |
| -use super::{BorrowedBuf, BufReader, BufWriter, ErrorKind, Read, Result, Write, DEFAULT_BUF_SIZE}; |
| 1 | +use super::{BorrowedBuf, BufReader, BufWriter, Read, Result, Write, DEFAULT_BUF_SIZE}; |
2 | 2 | use crate::alloc::Allocator;
|
3 | 3 | use crate::cmp;
|
4 | 4 | use crate::collections::VecDeque;
|
@@ -30,6 +30,7 @@ mod tests;
|
30 | 30 | ///
|
31 | 31 | /// [`read`]: Read::read
|
32 | 32 | /// [`write`]: Write::write
|
| 33 | +/// [`ErrorKind::Interrupted`]: crate::io::ErrorKind::Interrupted |
33 | 34 | ///
|
34 | 35 | /// # Examples
|
35 | 36 | ///
|
@@ -163,7 +164,7 @@ where
|
163 | 164 | // from adding I: Read
|
164 | 165 | match self.read(&mut []) {
|
165 | 166 | Ok(_) => {}
|
166 |
| - Err(e) if e.kind() == ErrorKind::Interrupted => continue, |
| 167 | + Err(e) if e.is_interrupted() => continue, |
167 | 168 | Err(e) => return Err(e),
|
168 | 169 | }
|
169 | 170 | let buf = self.buffer();
|
@@ -243,7 +244,7 @@ impl<I: Write + ?Sized> BufferedWriterSpec for BufWriter<I> {
|
243 | 244 | // Read again if the buffer still has enough capacity, as BufWriter itself would do
|
244 | 245 | // This will occur if the reader returns short reads
|
245 | 246 | }
|
246 |
| - Err(ref e) if e.kind() == ErrorKind::Interrupted => {} |
| 247 | + Err(ref e) if e.is_interrupted() => {} |
247 | 248 | Err(e) => return Err(e),
|
248 | 249 | }
|
249 | 250 | } else {
|
@@ -275,7 +276,7 @@ impl<A: Allocator> BufferedWriterSpec for Vec<u8, A> {
|
275 | 276 | let mut buf: BorrowedBuf<'_> = self.spare_capacity_mut().into();
|
276 | 277 | match reader.read_buf(buf.unfilled()) {
|
277 | 278 | Ok(()) => {}
|
278 |
| - Err(e) if e.kind() == ErrorKind::Interrupted => continue, |
| 279 | + Err(e) if e.is_interrupted() => continue, |
279 | 280 | Err(e) => return Err(e),
|
280 | 281 | };
|
281 | 282 |
|
@@ -307,7 +308,7 @@ fn stack_buffer_copy<R: Read + ?Sized, W: Write + ?Sized>(
|
307 | 308 | loop {
|
308 | 309 | match reader.read_buf(buf.unfilled()) {
|
309 | 310 | Ok(()) => {}
|
310 |
| - Err(e) if e.kind() == ErrorKind::Interrupted => continue, |
| 311 | + Err(e) if e.is_interrupted() => continue, |
311 | 312 | Err(e) => return Err(e),
|
312 | 313 | };
|
313 | 314 |
|
|
0 commit comments