pub struct MRZParser;Expand description
Top-level MRZ parser.
try_parsereturnsOption<MRZResult>(Noneon error).parsereturnsResult<MRZResult, MRZError>(error when input is invalid or parsing fails).
Implementations§
Source§impl MRZParser
impl MRZParser
Sourcepub fn try_parse(input: Option<Vec<Option<String>>>) -> Option<MRZResult>
pub fn try_parse(input: Option<Vec<Option<String>>>) -> Option<MRZResult>
Attempt to parse the given MRZ lines, returning Some(MRZResult) on
success or None if parsing fails for any reason.
Input accepts an optional outer vector whose elements may themselves be optional strings (to model upstream OCR results that may be null).
Sourcepub fn parse(input: Option<Vec<Option<String>>>) -> Result<MRZResult, MRZError>
pub fn parse(input: Option<Vec<Option<String>>>) -> Result<MRZResult, MRZError>
Parse MRZ input and return a MRZResult or a MRZError.
High-level flow:
- Polish input (filter nulls, uppercase, validate allowed MRZ chars).
- Attempt to parse with the TD1 parser if it recognises the format.
- Otherwise attempt TD2, then TD3.
- If none match, return
InvalidMRZInput.
Auto Trait Implementations§
impl Freeze for MRZParser
impl RefUnwindSafe for MRZParser
impl Send for MRZParser
impl Sync for MRZParser
impl Unpin for MRZParser
impl UnsafeUnpin for MRZParser
impl UnwindSafe for MRZParser
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