pub enum ValidationResult {
Valid,
InvalidLength {
expected: usize,
actual: usize,
},
InvalidCharacter {
char: char,
position: usize,
},
InvalidCheckDigit,
InvalidFormat {
reason: String,
},
}Expand description
Validation result with detailed information.
This enum provides specific information about why a code validation succeeded or failed, useful for user feedback.
Variants§
Valid
Code is valid (format check passed).
InvalidLength
Code has wrong length.
InvalidCharacter
Code contains character not in alphabet.
Fields
InvalidCheckDigit
Check digit verification failed.
InvalidFormat
Format mismatch (prefix/suffix/separator).
Implementations§
Source§impl ValidationResult
impl ValidationResult
Sourcepub fn error_code(&self) -> u8
pub fn error_code(&self) -> u8
Returns the error code for FFI compatibility.
Sourcepub fn error_position(&self) -> i32
pub fn error_position(&self) -> i32
Returns the error position for character errors, or -1 if not applicable.
Sourcepub fn error_char(&self) -> char
pub fn error_char(&self) -> char
Returns the invalid character, or ‘\0’ if not applicable.
Trait Implementations§
Source§impl Clone for ValidationResult
impl Clone for ValidationResult
Source§fn clone(&self) -> ValidationResult
fn clone(&self) -> ValidationResult
Returns a duplicate of the value. Read more
1.0.0 · 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 ValidationResult
impl Debug for ValidationResult
Source§impl PartialEq for ValidationResult
impl PartialEq for ValidationResult
impl Eq for ValidationResult
impl StructuralPartialEq for ValidationResult
Auto Trait Implementations§
impl Freeze for ValidationResult
impl RefUnwindSafe for ValidationResult
impl Send for ValidationResult
impl Sync for ValidationResult
impl Unpin for ValidationResult
impl UnwindSafe for ValidationResult
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