pub enum Pattern {
Prefix(String),
Suffix(String),
Contains(String),
}Expand description
A pattern to match against addresses.
Variants§
Prefix(String)
Match addresses starting with this prefix.
Suffix(String)
Match addresses ending with this suffix.
Contains(String)
Match addresses containing this substring.
Implementations§
Source§impl Pattern
impl Pattern
Sourcepub fn prefix(s: &str) -> Result<Self, PatternError>
pub fn prefix(s: &str) -> Result<Self, PatternError>
Create a prefix pattern.
Sourcepub fn suffix(s: &str) -> Result<Self, PatternError>
pub fn suffix(s: &str) -> Result<Self, PatternError>
Create a suffix pattern.
Sourcepub fn contains(s: &str) -> Result<Self, PatternError>
pub fn contains(s: &str) -> Result<Self, PatternError>
Create a contains pattern.
Sourcepub fn matches(&self, address: &str, case_sensitive: bool) -> bool
pub fn matches(&self, address: &str, case_sensitive: bool) -> bool
Check if an address matches this pattern.
Sourcepub fn validate_for_type(
&self,
address_type: AddressType,
testnet: bool,
) -> Result<(), PatternError>
pub fn validate_for_type( &self, address_type: AddressType, testnet: bool, ) -> Result<(), PatternError>
Validate this pattern for a specific address type.
Sourcepub fn difficulty(&self, address_type: AddressType, case_sensitive: bool) -> f64
pub fn difficulty(&self, address_type: AddressType, case_sensitive: bool) -> f64
Calculate the difficulty of finding this pattern. Returns the expected number of attempts.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pattern
impl RefUnwindSafe for Pattern
impl Send for Pattern
impl Sync for Pattern
impl Unpin for Pattern
impl UnwindSafe for Pattern
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,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more