nhi

Crates.ionhi
lib.rsnhi
version0.1.2
created_at2023-08-30 04:47:36.074785+00
updated_at2025-08-09 10:20:22.181083+00
descriptionA function to check strings against the New Zealand Ministry of Health NHI Validation Routine
homepage
repositoryhttps://codeberg.org/james-ansley/nhi
max_upload_size
id958715
size27,190
James Ansley (James-Ansley)

documentation

README

NHI

Repository License crates.io

Checks strings against the New Zealand Ministry of Health NHI Validation Routine. Supports the old and new NHI number formats specified in HISO 10046:2023.

Install

cargo add nhi

Docs

Example

NHI values can be validated with the is_nhi function, or parsed to NHI structs:

use nhi::{is_nhi, NHI};

fn main() {
    let nhi_str = "zac5361";

    assert_eq!(is_nhi(nhi_str), true);
    
    let nhi: NHI = nhi_str.parse().unwrap();
    assert_eq!(nhi.as_str(), nhi_str.to_uppercase());
}

More examples are available in the docs.

See Also

Commit count: 0

cargo fmt