brids
Parse and generate random CPF and CNPJ, Brazil's ID numbers.
Usage
Add the following to your Cargo.toml:
[]
= "0.5"
Features
All dependencies are optional and disabled by default:
no_std mode
To enable no_std mode, just disable the default features:
[]
= { = "0.5", = false }
Examples
Parse and format:
use ;
let maybe_valid = "123.456.789-09".;
assert!; // Checks validity
let old_format = "123.456.789/09".;
assert!; // Accepts the old format too
let unformatted = "12345678909"..expect;
let formatted = unformatted.to_string; // Formats
println!; // Formats too
// Generate random CNPJ and CPF numbers
println!;
println!;
License
brids is licensed under either of the following, at your option:
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or https://opensource.org/licenses/MIT)