pub trait PeselTrait: TryFrom<u64> + Into<u64>{
// Required methods
fn day_section(&self) -> u8;
fn month_section(&self) -> u8;
fn year_section(&self) -> u8;
fn ordinal_section(&self) -> u16;
fn control_section(&self) -> u8;
// Provided methods
fn day(&self) -> u8 { ... }
fn month(&self) -> u8 { ... }
fn year(&self) -> u16 { ... }
fn date_of_birth(&self) -> NaiveDate { ... }
fn gender(&self) -> Gender { ... }
}Expand description
Trait for implementing a PESEL.
It’s required for a PESEL to implement TryFrom<u64> and Into<u64> (for Self and &Self)
where the u64 PESEL must be represented as a human readable number.
The only required methods are for extracting each section. The rest is computed based on that.
Required Methods§
Sourcefn day_section(&self) -> u8
fn day_section(&self) -> u8
Day of birth section.
Sourcefn month_section(&self) -> u8
fn month_section(&self) -> u8
Month of birth section.
Sourcefn year_section(&self) -> u8
fn year_section(&self) -> u8
Year of birth section.
Sourcefn ordinal_section(&self) -> u16
fn ordinal_section(&self) -> u16
Ordinal section.
Sourcefn control_section(&self) -> u8
fn control_section(&self) -> u8
Control section.
Provided Methods§
Sourcefn date_of_birth(&self) -> NaiveDate
fn date_of_birth(&self) -> NaiveDate
Date of birth.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.