pub struct CurrencyRule;Expand description
Validates a value as an ISO 4217 currency code.
§Examples
use mx20022_validate::rules::currency::CurrencyRule;
use mx20022_validate::rules::Rule;
let rule = CurrencyRule;
let errors = rule.validate("USD", "/path");
assert!(errors.is_empty(), "USD is a valid currency code");
let errors = rule.validate("XYZ", "/path");
assert!(!errors.is_empty(), "XYZ is not a valid ISO 4217 code");
let errors = rule.validate("usd", "/path");
assert!(!errors.is_empty(), "Lowercase codes are rejected");Trait Implementations§
Auto Trait Implementations§
impl Freeze for CurrencyRule
impl RefUnwindSafe for CurrencyRule
impl Send for CurrencyRule
impl Sync for CurrencyRule
impl Unpin for CurrencyRule
impl UnsafeUnpin for CurrencyRule
impl UnwindSafe for CurrencyRule
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