Skip to content

Commit 22c74bd

Browse files
committed
streaming/lib: add PartialEq<Target> for State
1 parent 1a9ae87 commit 22c74bd

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

streaming/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,17 @@ impl PartialEq for State {
170170
}
171171
}
172172

173+
impl PartialEq<Target> for State {
174+
fn eq(&self, other: &Target) -> bool {
175+
matches!(
176+
(self, other),
177+
(State::Closed, Target::Closed)
178+
| (State::Open { .. }, Target::Open { .. })
179+
| (State::Streaming { .. }, Target::Streaming { .. })
180+
)
181+
}
182+
}
183+
173184
impl fmt::Debug for State {
174185
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
175186
match self {

0 commit comments

Comments
 (0)