Crate vin_parser
source ·Expand description
Vehicle Identification Number parser
Parser and checksum verifier for VIN.
Provides information about region, manufacturer, country of origin, possible years of assembling and checksum validation of given Vehicle Identification Number.
Examples
// Check whether VIN is ok (without checksum validation)
let vin_number = "WP0ZZZ99ZTS392124";
assert!(vin::check_validity(vin_number).is_ok());
// Check VIN with checksum validation
let vin_number = "1M8GDM9AXKP042788";
assert!(vin::verify_checksum(vin_number).is_ok());
// 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());
Structs
Provides information about invalid checksum calculation from the VIN
Holds parsed information about the vehicle
Enums
Provides possible errors during VIN parsing
Functions
Validates Vehicle Identification Number without computing the checksum
(check used symbols and length of the number)
Return basic information about manufacturer of the vehicle
Validates Vehicle Identification Number AND validates the checksum