Crates.io | card-validate |
lib.rs | card-validate |
version | 2.4.0 |
source | src |
created_at | 2017-08-27 09:56:02.668452 |
updated_at | 2024-03-30 21:06:31.829379 |
description | Rust card validate detects and validates credit card numbers |
homepage | https://github.com/valeriansaliou/rs-card-validate |
repository | https://github.com/valeriansaliou/rs-card-validate.git |
max_upload_size | |
id | 29433 |
size | 20,137 |
Detects and validates credit card numbers (type of card, number length and Luhn checksum).
Important notice: this is a complete rework of @rprotasov initial work, supporting more card providers and containing important validation fixes.
🇫🇷 Crafted in Brest, France.
Debit cards:
Credit cards:
In your Cargo.toml
:
[dependencies]
card-validate = "2.3"
extern crate card_validate;
use card_validate::Validate;
let card_number = "5236313877109142";
match Validate::from(card_number) {
Ok(result) => println!("Card type is: {}", result.card_type.name()),
Err(err) => println!("Card is invalid: {:?}", err)
}