#[non_exhaustive]pub enum ChainIdPattern {
Wildcard {
namespace: String,
},
Exact {
namespace: String,
reference: String,
},
Set {
namespace: String,
references: HashSet<String>,
},
}Expand description
A pattern for matching chain IDs.
Chain ID patterns allow flexible matching of blockchain networks:
- Wildcard: Matches any chain within a namespace (e.g.,
eip155:*matches all EVM chains) - Exact: Matches a specific chain (e.g.,
eip155:8453matches only Base) - Set: Matches any chain from a set (e.g.,
eip155:{1,8453,137}matches Ethereum, Base, or Polygon)
§Serialization
Patterns serialize to human-readable strings:
- Wildcard:
"eip155:*" - Exact:
"eip155:8453" - Set:
"eip155:{1,8453,137}"
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Wildcard
Matches any chain within the specified namespace.
Exact
Matches exactly one specific chain.
Set
Matches any chain from a set of references within a namespace.
Implementations§
Source§impl ChainIdPattern
impl ChainIdPattern
Sourcepub fn wildcard<S: Into<String>>(namespace: S) -> Self
pub fn wildcard<S: Into<String>>(namespace: S) -> Self
Creates a wildcard pattern that matches any chain in the given namespace.
Sourcepub fn exact<N: Into<String>, R: Into<String>>(
namespace: N,
reference: R,
) -> Self
pub fn exact<N: Into<String>, R: Into<String>>( namespace: N, reference: R, ) -> Self
Creates an exact pattern that matches only the specified chain.
Sourcepub fn set<N: Into<String>>(namespace: N, references: HashSet<String>) -> Self
pub fn set<N: Into<String>>(namespace: N, references: HashSet<String>) -> Self
Creates a set pattern that matches any chain from the given set of references.
Trait Implementations§
Source§impl Clone for ChainIdPattern
impl Clone for ChainIdPattern
Source§fn clone(&self) -> ChainIdPattern
fn clone(&self) -> ChainIdPattern
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ChainIdPattern
impl Debug for ChainIdPattern
Source§impl<'de> Deserialize<'de> for ChainIdPattern
impl<'de> Deserialize<'de> for ChainIdPattern
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ChainIdPattern
impl Display for ChainIdPattern
Source§impl From<ChainId> for ChainIdPattern
impl From<ChainId> for ChainIdPattern
Source§impl FromStr for ChainIdPattern
impl FromStr for ChainIdPattern
Auto Trait Implementations§
impl Freeze for ChainIdPattern
impl RefUnwindSafe for ChainIdPattern
impl Send for ChainIdPattern
impl Sync for ChainIdPattern
impl Unpin for ChainIdPattern
impl UnsafeUnpin for ChainIdPattern
impl UnwindSafe for ChainIdPattern
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more