Crates.io | imei |
lib.rs | imei |
version | 1.1.1 |
source | src |
created_at | 2022-03-01 16:39:25.009183 |
updated_at | 2023-03-21 20:33:48.441658 |
description | An IMEI number validator |
homepage | |
repository | https://github.com/grantshandy/imei |
max_upload_size | |
id | 541656 |
size | 22,926 |
An IMEI number validator implemented in Rust.
imei = "1"
Basic example:
fn main() {
let num = "490154203237518";
let valid = imei::valid(num);
println!("{num}: {valid}");
}
Result:
490154203237518: true
This validator is designed to be as fast and efficient as possible. It uses small number types, precalculates the character conversions, and only iterates through the imei number once. The speed test in the tests directory gets the average speed of validation over 10,000,000 cycles. Typically, the validation process sub 1000th of a milisecond (practically instant!).
std
is enabled by default which implements error::Error
for imei::Error
.serde
feature adds serialization/deserialization for the Imei
struct.