credit_card_types

Crates.iocredit_card_types
lib.rscredit_card_types
version0.1.200
sourcesrc
created_at2023-08-05 20:55:18.835641
updated_at2024-01-06 19:52:49.347008
descriptionDetect credit card types by number
homepage
repositoryhttps://github.com/OLoKo64/credit-card-types
max_upload_size
id936786
size36,953
Reinaldo Rozato Junior (oloko64)

documentation

README

Credit Card Types

Rust Workflow

The Credit Card Type library for Rust provides a utility method to determine the type of credit card based on both fully qualified and partial card numbers.

Features

  • Determine the type of credit card based on the provided card number (fully qualified or partial).
  • Support for popular credit card types like Visa, MasterCard, American Express, Discover, and more.
  • No dependencies.

Usage

use credit_card_types::{CreditCardPool, CreditCardType};

fn main() {
    // Create a new pool.
    let pool = CreditCardPool::new();

    // Get the credit card type for a given card number.
    let result = pool.get_credit_card_type("4111111111111111").unwrap();

    // Print the result.
    println!("Credit card type: {:#?}", result);
}

This crate was inspired by the credit-card-type NPM package.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Commit count: 16

cargo fmt