#[non_exhaustive]pub enum IsinError {
Empty,
InvalidLength {
found: usize,
},
InvalidCharacter {
character: char,
position: u8,
expected: CharacterClass,
},
InvalidCheckDigit {
expected: u8,
found: u8,
},
}Expand description
The set of reasons an ISIN string can fail validation.
Every fallible constructor of Isin returns this type; each variant maps to a
single, specific failure so callers can react programmatically (for example, highlighting the
offending character in a form field) rather than parsing a human-readable message.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Empty
The input was an empty string.
InvalidLength
After trimming surrounding whitespace, the input did not contain exactly 12 characters.
InvalidCharacter
A character outside the allowed set was found at a given position.
Fields
§
expected: CharacterClassThe character class that was expected at this position.
InvalidCheckDigit
The Luhn check digit (position 12) did not match the value computed from the first 11 characters.
Trait Implementations§
impl Eq for IsinError
Source§impl Error for IsinError
impl Error for IsinError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
impl StructuralPartialEq for IsinError
Auto Trait Implementations§
impl Freeze for IsinError
impl RefUnwindSafe for IsinError
impl Send for IsinError
impl Sync for IsinError
impl Unpin for IsinError
impl UnsafeUnpin for IsinError
impl UnwindSafe for IsinError
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