pub struct Ssn {
pub day: usize,
pub month: usize,
pub year: usize,
pub gender: Gender,
}Expand description
The personal identity code.
§Example
Parse and validate personal identity code:
use hetu::Ssn;
use std::convert::TryFrom;
Ssn::try_from("141286-245T");Generate random personal identity code:
use hetu::Ssn;
Ssn::generate();Fields§
§day: usize§month: usize§year: usize§gender: GenderImplementations§
Source§impl Ssn
impl Ssn
Sourcepub fn generate() -> String
pub fn generate() -> String
Generate random personal identity code.
Temporary personal identity code with identifier range of 900-999 will never be created. To generate a
temporary personal identity code, use Ssn::generate_by_pattern(pattern) with pattern that explicity has ‘9’ as the
first character of the identifier part.
Sourcepub fn generate_by_pattern(
pattern: &SsnPattern,
) -> Result<String, GenerateError>
pub fn generate_by_pattern( pattern: &SsnPattern, ) -> Result<String, GenerateError>
Generate personal identity code with matching fields.
Sourcepub fn iter<'a>(pattern: &SsnPattern) -> impl Iterator<Item = String> + 'a
pub fn iter<'a>(pattern: &SsnPattern) -> impl Iterator<Item = String> + 'a
Iterator for generated personal identity code with matching fields.
Trait Implementations§
impl Copy for Ssn
impl Eq for Ssn
impl StructuralPartialEq for Ssn
Auto Trait Implementations§
impl Freeze for Ssn
impl RefUnwindSafe for Ssn
impl Send for Ssn
impl Sync for Ssn
impl Unpin for Ssn
impl UnwindSafe for Ssn
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