1 个稳定版本

1.0.0 2022年12月21日

#2 in #vin

Download history 15/week @ 2024-03-31 3/week @ 2024-04-14 29/week @ 2024-04-21 44/week @ 2024-05-05 42/week @ 2024-05-12 32/week @ 2024-05-19 16/week @ 2024-05-26 75/week @ 2024-06-02 102/week @ 2024-06-09 31/week @ 2024-06-16 68/week @ 2024-06-23

277 每月下载量

MIT 许可证

34KB
828

VIN

Build Status codecov License: MIT docs: latest

Rust的车辆识别号码(VIN)解析器和验证器。

提供有关地区、制造商、原产国、可能的组装年份以及给定车辆识别号码的校验和验证信息。

示例

将依赖项添加到您的 Cargo.toml

[dependencies]
vin = "1.0.0"

然后,在您的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());

感谢

受此存储库启发: https://github.com/idlesign/vininfo

依赖项

~10KB