pub struct Cpf { /* private fields */ }Expand description
§Examples
use bras::Cpf;
use core::str::FromStr;
let cpf = Cpf::from_str("98484485439")?;
assert_eq!("984.844.854-39", cpf.to_string());
let cpf = Cpf::from_str("984.844.854-39")?;
assert_eq!("984.844.854-39", cpf.to_string());
§Conversions
use bras::Cpf;
let cpf = "984.844.854-39".parse::<Cpf>()?;
assert_eq!("984.844.854-39", cpf.to_string());
let cpf: Cpf = "984.844.854-39".parse()?;
assert_eq!("98484485439", cpf.numbers_as_string());
let cpf: Cpf = "984.844.854-39".parse()?;
assert_eq!(98484485439u64, u64::from(cpf));
let cpf: Cpf = "98484485439".parse()?;
assert_eq!(String::from("984.844.854-39"), String::from(cpf));
let number: u64 = 98484485439;
let cpf: Cpf = Cpf::try_from(98484485439)?;
assert_eq!("984.844.854-39", cpf.to_string());
Implementations§
Trait Implementations§
source§impl Ord for Cpf
impl Ord for Cpf
source§impl PartialOrd for Cpf
impl PartialOrd for Cpf
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Copy for Cpf
impl Eq for Cpf
impl StructuralPartialEq for Cpf
Auto Trait Implementations§
impl RefUnwindSafe for Cpf
impl Send for Cpf
impl Sync for Cpf
impl Unpin 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