Skip to content

[Mirror] Parse and generate random CPF and CNPJ, Brazil's ID numbers, using Rust.

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

ricvelozo/brids-rs

brids

Parse and generate random CPF and CNPJ, Brazil's ID numbers.

Usage

Add the following to your Cargo.toml:

[dependencies]
brids = "0.4"

Examples

Parse and format:

use brids::Cpf;
use std::io;

fn main() {
    println!("Enter a CPF number:");
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();

    match input.trim().parse::<Cpf>() {
        Ok(cpf) => println!("{cpf} is a valid number."),
        Err(err) => eprintln!("Error: {err}"),
    }
}

Generate random CNPJ and CPF numbers:

use brids::{Cnpj, Cpf};

fn main() {
    println!("Random CNPJ number: {}", Cnpj::generate());
    println!("Random CPF number: {}", Cpf::generate());
}

License

brids is licensed under either of the following, at your option:

About

[Mirror] Parse and generate random CPF and CNPJ, Brazil's ID numbers, using Rust.

Topics

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages