5 stable releases
| 1.1.1 | Mar 21, 2023 |
|---|---|
| 1.1.0 | Jan 17, 2023 |
| 1.0.2 | Mar 24, 2022 |
| 1.0.1 | Mar 16, 2022 |
| 1.0.0 | Mar 1, 2022 |
#2044 in Algorithms
738 downloads per month
Used in uuinfo
9KB
132 lines
imei
An IMEI number validator implemented in Rust.
imei = "1"
Example
Basic example:
fn main() {
let num = "490154203237518";
let valid = imei::valid(num);
println!("{num}: {valid}");
}
Result:
490154203237518: true
Speed
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!).
Features
- The
stdis enabled by default which implementserror::Errorforimei::Error. - The
serdefeature adds serialization/deserialization for theImeistruct.
Dependencies
~0.3–1MB
~21K SLoC