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