Skip to content

Commit

Permalink
feat: add is_ utils to FilterChanges (alloy-rs#923)
Browse files Browse the repository at this point in the history
* feat: add is_ utils to FilterChanges

* fix clippy
  • Loading branch information
tcoratger authored and ben186 committed Jul 27, 2024
1 parent 0ce6ea0 commit 1dd8ddc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions crates/rpc-types-eth/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,26 @@ impl<T> FilterChanges<T> {
None
}
}

/// Check if the filter changes are empty.
pub const fn is_empty(&self) -> bool {
matches!(self, Self::Empty)
}

/// Check if the filter changes contain logs.
pub const fn is_logs(&self) -> bool {
matches!(self, Self::Logs(_))
}

/// Check if the filter changes contain hashes.
pub const fn is_hashes(&self) -> bool {
matches!(self, Self::Hashes(_))
}

/// Check if the filter changes contain transactions.
pub const fn is_transactions(&self) -> bool {
matches!(self, Self::Transactions(_))
}
}

mod empty_array {
Expand Down

0 comments on commit 1dd8ddc

Please sign in to comment.