| Crates.io | creditcard |
| lib.rs | creditcard |
| version | 0.1.0 |
| created_at | 2025-01-07 03:13:16.695347+00 |
| updated_at | 2025-01-07 03:13:16.695347+00 |
| description | Zero-dependency credit card parser and validator. |
| homepage | |
| repository | https://github.com/matteopolak/creditcard |
| max_upload_size | |
| id | 1506638 |
| size | 45,899 |
Zero-dependency credit card number validation and parsing for Rust.
use creditcard::{CreditCard, CreditCardKind};
let card = "4111111111111111".parse::<CreditCard>().unwrap();
assert_eq!(card.kind(), CreditCardKind::Visa);
assert_eq!(card.pan(), 4111111111111111);
See the benches directory for basic micro-benchmarks.
| benchmark | creditcard |
card-validate |
|---|---|---|
too short |
27.740ns | 280.77ns |
too long |
23.787ns | 280.06ns |
invalid |
18.113ns | 279.38ns |
valid |
28.651ns | 139.38ns |