Skip to content

Commit f6aa3be

Browse files
authored
Add Error::is_reset function (#618)
1 parent dc7aa8e commit f6aa3be

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/error.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ impl Error {
5959

6060
/// Returns true if the error is an io::Error
6161
pub fn is_io(&self) -> bool {
62-
match self.kind {
63-
Kind::Io(_) => true,
64-
_ => false,
65-
}
62+
matches!(self.kind, Kind::Io(..))
6663
}
6764

6865
/// Returns the error if the error is an io::Error
@@ -92,6 +89,11 @@ impl Error {
9289
matches!(self.kind, Kind::GoAway(..))
9390
}
9491

92+
/// Returns true if the error is from a `RST_STREAM`.
93+
pub fn is_reset(&self) -> bool {
94+
matches!(self.kind, Kind::Reset(..))
95+
}
96+
9597
/// Returns true if the error was received in a frame from the remote.
9698
///
9799
/// Such as from a received `RST_STREAM` or `GOAWAY` frame.

0 commit comments

Comments
 (0)