cpf-rs
Brazilian CPF parsing, validating and formatting library.
use Cpf;
// If all you need is validating a CPF number, use the `valid` function:
assert!;
// For formatting and additional metadata from the number, parse into a `Cpf` struct:
let cpf: Cpf = "38521139039".parse.unwrap;
assert_eq!;
assert_eq!;
no_std support
The library can be used on no_std environments by disabling the std
flag:
[]
= { = "0.1", = false }
Random CPF generation support
The rand
feature flag enables random CPF generation:
[]
= { = "0.1", = ["rand"] }
= "0.8"
use Cpf;
use rand;
use Rng;
let cpf: Cpf = thread_rng.gen;