7 releases (4 breaking)

0.5.2 Jul 13, 2024
0.5.1 Sep 22, 2023
0.5.0 Jun 4, 2023
0.4.0 Aug 15, 2020
0.1.0 Sep 22, 2018

#540 in Parser implementations

Download history 362/week @ 2024-09-20 346/week @ 2024-09-27 447/week @ 2024-10-04 375/week @ 2024-10-11 435/week @ 2024-10-18 299/week @ 2024-10-25 518/week @ 2024-11-01 403/week @ 2024-11-08 518/week @ 2024-11-15 423/week @ 2024-11-22 684/week @ 2024-11-29 460/week @ 2024-12-06 499/week @ 2024-12-13 106/week @ 2024-12-20 5/week @ 2024-12-27 170/week @ 2025-01-03

857 downloads per month

MIT/Apache

24KB
518 lines

mrtd

Crate Documentation Build Status

A Rust parser for the machine-readable zone (MRZ) of machine-readable travel documents (MRTD) as defined by ICAO Document 9303.

Supported travel documents:

  • Passport
  • Identity Card

Example

use mrtd::{parse, Document};

fn main() {
    let passport_mrz = "P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<\
        L898902C36UTO7408122X1204159ZE184226B<<<<<10";
    if let Document::Passport(passport) = parse(passport_mrz).unwrap() {
        assert_eq!(passport.passport_number, "L898902C3");
        println!("{:?}", passport);
    }

    let id_card_mrz = "C<ITACA00000AA4<<<<<<<<<<<<<<<\
        6412308F2212304ITA<<<<<<<<<<<0\
        ROSSI<<BIANCA<<<<<<<<<<<<<<<<<";
    if let Document::IdentityCard(identity_card) = parse(id_card_mrz).unwrap() {
        assert_eq!(identity_card.document_number, "CA00000AA");
        println!("{:?}", identity_card);
    };
}

Dependencies

~3–4.5MB
~76K SLoC