pesel_rs

Trait PeselTrait

Source
pub trait PeselTrait: TryFrom<u64> + Into<u64>
where for<'a> u64: From<Self> + From<&'a Self>,
{ // 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§

Source

fn day_section(&self) -> u8

Day of birth section.

Source

fn month_section(&self) -> u8

Month of birth section.

Source

fn year_section(&self) -> u8

Year of birth section.

Source

fn ordinal_section(&self) -> u16

Ordinal section.

Source

fn control_section(&self) -> u8

Control section.

Provided Methods§

Source

fn day(&self) -> u8

Day of birth.

Source

fn month(&self) -> u8

Month of birth.

Source

fn year(&self) -> u16

Year of birth.

Source

fn date_of_birth(&self) -> NaiveDate

Date of birth.

Source

fn gender(&self) -> Gender

Gender.

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.

Implementors§

Source§

impl PeselTrait for pesel_rs::bit_fields::Pesel

Source§

impl PeselTrait for pesel_rs::human_redable::Pesel