Crates.io | vin_parser |
lib.rs | vin_parser |
version | 1.0.0 |
source | src |
created_at | 2022-12-21 22:38:02.140488 |
updated_at | 2022-12-21 22:38:02.140488 |
description | Vehicle Identification Number (VIN) parser and validator. |
homepage | |
repository | https://github.com/maybe-hello-world/vin_parser |
max_upload_size | |
id | 743498 |
size | 37,139 |
Vehicle Identification Number (VIN) parser and validator for Rust.
Provides information about region, manufacturer, country of origin, possible years of assembling and checksum validation of given Vehicle Identification Number.
Add dependency to your Cargo.toml
[dependencies]
vin = "1.0.0"
Then, in your crate:
extern crate vin;
let vin_number = "WP0ZZZ99ZTS392124";
assert!(vin::check_validity(vin_number).is_ok());
extern crate vin;
// Check VIN with checksum validation
let vin_number = "1M8GDM9AXKP042788";
assert!(vin::verify_checksum(vin).is_ok());
extern crate vin;
// Get VIN information
let vin_number = "wp0zzz998ts392124";
let result = vin::get_info(vin_number).unwrap();
assert_eq!(result.vin, vin_number.to_uppercase());
assert_eq!(result.country, "Germany/West Germany");
assert_eq!(result.manufacturer, "Porsche car");
assert_eq!(result.region, "Europe");
assert!(result.valid_checksum.is_ok());
Inspired by this repository: https://github.com/idlesign/vininfo.