about summary refs log tree commit diff
path: root/library/std/src/io/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/std/src/io/error.rs')
-rw-r--r--library/std/src/io/error.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/library/std/src/io/error.rs b/library/std/src/io/error.rs
index 34c0ce9dcf8..d6fce4ee78f 100644
--- a/library/std/src/io/error.rs
+++ b/library/std/src/io/error.rs
@@ -916,6 +916,16 @@ impl Error {
             ErrorData::SimpleMessage(m) => m.kind,
         }
     }
+
+    #[inline]
+    pub(crate) fn is_interrupted(&self) -> bool {
+        match self.repr.data() {
+            ErrorData::Os(code) => sys::is_interrupted(code),
+            ErrorData::Custom(c) => c.kind == ErrorKind::Interrupted,
+            ErrorData::Simple(kind) => kind == ErrorKind::Interrupted,
+            ErrorData::SimpleMessage(m) => m.kind == ErrorKind::Interrupted,
+        }
+    }
 }
 
 impl fmt::Debug for Repr {