1 unstable release

new 0.8.0 May 22, 2025

#1313 in Parser implementations

ISC license

68KB
1.5K SLoC

mb-vin

A lightweight and zero-copy Rust crate for parsing and validating Vehicle Identification Numbers (VINs) according to the ISO 3779 standard.

Features

  • Parse and validate (length, characters set, check digit).
  • Extract WMI (World Manufacturer Identifier), VDS, VIS.
  • Lookup manufacturer and country from WMI.
  • Infer manufacturing year from VIN
  • Optional serde support with serialization and deserialization
  • Optional simd to fast batch parse

Installation

Add to your Cargo.toml:

mb_vin = "0.8.0"

Usage

use mb_vin::{Vin, Error};

fn main() -> Result<(), Error> {
    let vin_str = "5GZCZ43D13S812715";
    let vin = Vin::parse_str(vin_str)?;

    println!("WMI: {}", vin.wmi());
    println!("VDS: {}", vin.vds());
    println!("VIS: {}", vin.vis());
    println!("Check digit: {}", vin.check_digit());

    if let Some(info) = vin.lookup_wmi_info() {
        println!("Country: {}", info.country);
        println!("Manufacturer: {}", info.manufacturer);
        println!("Region: {}", info.region);
    }

    if let Some(year) = vin.year_of_manufacture() {
    	println!("Year: {}", year);
    }
    
    Ok(())
}

License

Licensed under an OpenBSD-ISC-style license, see LICENSE for details.

Dependencies

~0–435KB