pub struct Cpf { /* private fields */ }Expand description
A validated CPF stored as 11 ASCII bytes.
use stdbr_core::cpf::{Cpf, generate_cpf};
let cpf = generate_cpf();
assert_eq!(cpf.as_str().len(), 11);
assert_eq!(cpf.to_string().len(), 14); // ###.###.###-##
let parsed: Cpf = cpf.to_string().parse().unwrap();
assert_eq!(cpf, parsed);Implementations§
Source§impl Cpf
impl Cpf
Sourcepub fn fiscal_region(&self) -> FiscalRegion
pub fn fiscal_region(&self) -> FiscalRegion
Fiscal region derived from the 9th digit.
Sourcepub fn check_digits(&self) -> (u8, u8)
pub fn check_digits(&self) -> (u8, u8)
The two check digits (d1, d2).
Trait Implementations§
impl Copy for Cpf
impl Eq for Cpf
impl StructuralPartialEq for Cpf
Auto Trait Implementations§
impl Freeze for Cpf
impl RefUnwindSafe for Cpf
impl Send for Cpf
impl Sync for Cpf
impl Unpin for Cpf
impl UnsafeUnpin for Cpf
impl UnwindSafe for Cpf
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more