#[non_exhaustive]pub enum CfiError {
Empty,
InvalidLength {
found: usize,
},
InvalidCharacter {
character: char,
position: u8,
},
UnknownCategory {
code: char,
},
UnknownGroup {
category: char,
code: char,
},
InvalidAttribute {
category: char,
group: char,
index: u8,
code: char,
},
}Expand description
The set of reasons a CFI string can fail validation.
Every fallible constructor of Cfi returns this type. Unlike CNPJ or ISIN, a CFI
carries no checksum; instead its validity is defined by the ISO 10962 code taxonomy, so beyond
the structural checks there are three taxonomic failure modes (CfiError::UnknownCategory,
CfiError::UnknownGroup, CfiError::InvalidAttribute). Each variant maps to a single,
specific failure so callers can react programmatically rather than parsing a message.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Empty
The input was an empty string.
InvalidLength
After trimming surrounding whitespace, the input did not contain exactly 6 characters.
InvalidCharacter
A character outside A–Z was found at a given position. Every CFI position is an
uppercase ASCII letter.
Fields
UnknownCategory
The category letter (position 1) is not one defined by ISO 10962.
UnknownGroup
The group letter (position 2) is not defined for the otherwise-valid category.
Fields
InvalidAttribute
An attribute letter (positions 3–6) is not permitted for the resolved category and group at that attribute position.
Trait Implementations§
impl Eq for CfiError
Source§impl Error for CfiError
impl Error for CfiError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()