5 releases (stable)

3.1.1 Sep 30, 2022
3.0.2 Nov 1, 2021
0.1.0 May 13, 2021

#39 in #personal

46 downloads per month
Used in organisationsnummer

MIT license

13KB
280 lines

Personnummer

Crates.io Rust

Validate Swedish personal identity numbers with Rust.

Usage

use personnummer::Personnummer;

fn main() {
    match Personnummer::new("199001011-0017") {
        Ok(pnr) => println!("{}: {}", pnr.format().long(), pnr.valid()),
        Err(e) => panic!("Error: {}", e),
    }
}

Fore more details, see examples and/or run

$ cargo run --example personnummer <personnummer>

Dependencies

~3–9MB
~80K SLoC