pub struct Mod97Validator;Expand description
MOD-97 algorithm validator for IBANs and similar identifiers.
The MOD-97 algorithm is used to validate International Bank Account Numbers (IBANs) and other financial identifiers.
§Algorithm Steps
- Move the first 4 characters to the end
- Replace letters with numbers (A=10, B=11, …, Z=35)
- Calculate the remainder of the number modulo 97
- The remainder should be 1 for valid IBANs
Implementations§
Source§impl Mod97Validator
impl Mod97Validator
Sourcepub fn validate(value: &str) -> bool
pub fn validate(value: &str) -> bool
Validate a string using the MOD-97 algorithm.
§Arguments
value- The string to validate (typically an IBAN or similar identifier)
§Returns
true if the value passes MOD-97 validation, false otherwise
§Example
use fraiseql_core::validation::checksum::Mod97Validator;
assert!(Mod97Validator::validate("GB82WEST12345698765432")); // Valid IBAN
assert!(!Mod97Validator::validate("GB82WEST12345698765433")); // InvalidSourcepub fn error_message() -> &'static str
pub fn error_message() -> &'static str
Get a human-readable description of why validation failed.
Auto Trait Implementations§
impl Freeze for Mod97Validator
impl RefUnwindSafe for Mod97Validator
impl Send for Mod97Validator
impl Sync for Mod97Validator
impl Unpin for Mod97Validator
impl UnsafeUnpin for Mod97Validator
impl UnwindSafe for Mod97Validator
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