From 262a9c16c2b3bb93fa2ff55b1d65bdd770269bdf Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 31 Jan 2024 20:22:21 +0100 Subject: [PATCH] chore: add missing is functions (#6309) --- crates/net/eth-wire/src/types/version.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/net/eth-wire/src/types/version.rs b/crates/net/eth-wire/src/types/version.rs index bb1076a034..50a4a32733 100644 --- a/crates/net/eth-wire/src/types/version.rs +++ b/crates/net/eth-wire/src/types/version.rs @@ -38,6 +38,21 @@ impl EthVersion { } } } + + /// Returns true if the version is eth/66 + pub const fn is_eth66(&self) -> bool { + matches!(self, EthVersion::Eth66) + } + + /// Returns true if the version is eth/67 + pub const fn is_eth67(&self) -> bool { + matches!(self, EthVersion::Eth67) + } + + /// Returns true if the version is eth/68 + pub const fn is_eth68(&self) -> bool { + matches!(self, EthVersion::Eth68) + } } /// Allow for converting from a `&str` to an `EthVersion`.