# mb-vin
A lightweight and zero-copy Rust crate for parsing and validating [Vehicle
Identification Numbers (VINs)][VIN] according to the [ISO 3779][ISO3779]
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`:
```toml
mb_vin = "0.8.0"
```
## Usage
```rust
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](LICENSE) for details.
[VIN]: https://en.m.wikipedia.org/wiki/Vehicle_identification_number
[ISO3779]: https://cdn.standards.iteh.ai/samples/52200/7d8a69aee84c4ad28231053f49f4966e/ISO-3779-2009.pdf