pub struct Pinfl(/* private fields */);Expand description
JShShIR / PINFL — 14 raqamli shaxsiy identifikatsiya raqami.
parse() faqat strukturani (14 ta ASCII raqam) tekshiradi.
Nazorat raqami, jins/asr belgisi va tug’ilgan sana — query metodlar
(is_checksum_valid, gender, birth_date) yoki Pinfl::parse_strict.
Implementations§
Source§impl Pinfl
impl Pinfl
Sourcepub fn parse(value: &str) -> Result<Self, PinflError>
pub fn parse(value: &str) -> Result<Self, PinflError>
Matndan tip yaratadi: trim → normalizatsiya → validatsiya.
Bitta allocation (normalizatsiya qilingan nusxa uchun).
Sourcepub fn into_inner(self) -> String
pub fn into_inner(self) -> String
Ichki String (ownership ko’chadi, nusxa olinmaydi).
Source§impl Pinfl
impl Pinfl
Sourcepub fn parse_strict(value: &str) -> Result<Self, PinflError>
pub fn parse_strict(value: &str) -> Result<Self, PinflError>
Struktura + nazorat raqami + jins/asr belgisi + to’liq Gregorian sana.
Sana tekshiruvi date feature’idan mustaqil: 31.02 yoki 29.02.1900
checksum’i to’g’ri bo’lsa ham PinflError::Structure qaytaradi.
Sourcepub fn is_checksum_valid(&self) -> bool
pub fn is_checksum_valid(&self) -> bool
14-raqam rasmiy algoritm bo’yicha to’g’rimi (7‑3‑1 vaznlar, mod 10).
Sourcepub fn gender(&self) -> Option<Gender>
pub fn gender(&self) -> Option<Gender>
1-raqam: jins (1,3,5 — erkak; 2,4,6 — ayol). Boshqa qiymat → None.
Sourcepub fn birth_date_parts(&self) -> Option<(i32, u32, u32)>
pub fn birth_date_parts(&self) -> Option<(i32, u32, u32)>
2–7 raqamlar DDMMYY + asr → (yil, oy, kun).
Faqat to’liq Gregorian sana haqiqiy bo’lsa qiymat qaytaradi.
Sourcepub fn region_code(&self) -> &str
pub fn region_code(&self) -> &str
8–10 raqamlar: tug’ilgan hudud kodi.
Sourcepub fn birth_date(&self) -> Option<BirthDate>
Available on crate feature date only.
pub fn birth_date(&self) -> Option<BirthDate>
date only.PINFL ichidagi tug’ilgan sana (kalendar bo’yicha haqiqiy bo’lsa).
Tizim soatiga (UTC) tayanadi — BirthDate kelajak sanasini rad etadi,
shuning uchun 2000-yillar PINFL’i (5/6 + YY kelajakda) bugungi kunga
qarab Some/None bo’ladi. Testlarda birth_date_at.
Sourcepub fn birth_date_at(&self, today: NaiveDate) -> Option<BirthDate>
Available on crate feature date only.
pub fn birth_date_at(&self, today: NaiveDate) -> Option<BirthDate>
date only.birth_date ning deterministik varianti — “bugun” tashqaridan.
Trait Implementations§
Source§impl Borrow<str> for Pinfl
HashMap<$Name, V>::get("...") va BTreeMap uchun.
Hash/Eq/Ord ichki String dan derive qilingani uchun str bilan mos.
impl Borrow<str> for Pinfl
HashMap<$Name, V>::get("...") va BTreeMap uchun.
Hash/Eq/Ord ichki String dan derive qilingani uchun str bilan mos.
Source§impl<'de> Deserialize<'de> for Pinfl
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Pinfl
serde only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl<'q, DB: Database> Encode<'q, DB> for Pinfl
impl<'q, DB: Database> Encode<'q, DB> for Pinfl
Source§fn encode_by_ref(
&self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, BoxDynError>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, BoxDynError>
Source§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
Source§impl<'q, DB: Database> Encode<'q, DB> for Pinfl
impl<'q, DB: Database> Encode<'q, DB> for Pinfl
Source§fn encode_by_ref(
&self,
buf: &mut <DB as Database>::ArgumentBuffer,
) -> Result<IsNull, BoxDynError>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer, ) -> Result<IsNull, BoxDynError>
Source§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
fn size_hint(&self) -> usize
impl Eq for Pinfl
Source§impl Ord for Pinfl
impl Ord for Pinfl
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Pinfl
impl PartialOrd for Pinfl
Source§impl PgHasArrayType for Pinflwhere
String: PgHasArrayType,
impl PgHasArrayType for Pinflwhere
String: PgHasArrayType,
fn array_type_info() -> PgTypeInfo
fn array_compatible(ty: &PgTypeInfo) -> bool
Source§impl PgHasArrayType for Pinflwhere
String: PgHasArrayType,
impl PgHasArrayType for Pinflwhere
String: PgHasArrayType,
fn array_type_info() -> PgTypeInfo
fn array_compatible(ty: &PgTypeInfo) -> bool
impl StructuralPartialEq for Pinfl
Source§impl TryFrom<&str> for Pinfl
impl TryFrom<&str> for Pinfl
Source§type Error = PinflError
type Error = PinflError
Source§impl TryFrom<String> for Pinfl
Yagona “owned” yo’l: hech qachon qo’shimcha allocation qilmaydi.
impl TryFrom<String> for Pinfl
Yagona “owned” yo’l: hech qachon qo’shimcha allocation qilmaydi.
Source§type Error = PinflError
type Error = PinflError
Auto Trait Implementations§
impl Freeze for Pinfl
impl RefUnwindSafe for Pinfl
impl Send for Pinfl
impl Sync for Pinfl
impl Unpin for Pinfl
impl UnsafeUnpin for Pinfl
impl UnwindSafe for Pinfl
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more