Struct idcard::Identity [−][src]
pub struct Identity { /* fields omitted */ }
Expand description
An object representation of the Chinese ID.
Implementations
impl Identity
[src]
impl Identity
[src]pub fn birth_date(&self) -> Option<String>
[src]
pub fn birth_date(&self) -> Option<String>
[src]Returns the formatted date of birth(yyyy-mm-dd).
pub fn age(&self) -> Option<u32>
[src]
pub fn age(&self) -> Option<u32>
[src]Calculates the current age based on the computer’s local date,
if the birth year is less than the local’s, it returns None
.
pub fn age_in_year(&self, year: u32) -> Option<u32>
[src]
pub fn age_in_year(&self, year: u32) -> Option<u32>
[src]Calculates the age based on the given year, if the given year is less
than the birth year, it returns None
.
pub fn province(&self) -> Option<&str>
[src]
pub fn province(&self) -> Option<&str>
[src]Returns the province name based on the first 2 digits of the number
pub fn region(&self) -> Option<&str>
[src]
pub fn region(&self) -> Option<&str>
[src]Returns the region name based on the first 6 digits of the number
pub fn region_code(&self) -> Option<&str>
[src]
pub fn region_code(&self) -> Option<&str>
[src]Returns the region code(the first 6 digits)
pub fn constellation(&self) -> Option<&str>
[src]
pub fn constellation(&self) -> Option<&str>
[src]Returns the constellation by the date of birth.
pub fn chinese_era(&self) -> Option<String>
[src]
pub fn chinese_era(&self) -> Option<String>
[src]Returns the Chinese Era by the year of birth.
pub fn chinese_zodiac(&self) -> Option<&str>
[src]
pub fn chinese_zodiac(&self) -> Option<&str>
[src]Returns the Chinese Zodiac animal by the year of birth.
pub fn to_json_string(&self, pretty: bool) -> String
[src]
pub fn to_json_string(&self, pretty: bool) -> String
[src]Converts the value to a JSON string.
Trait Implementations
impl Ord for Identity
[src]
impl Ord for Identity
[src]impl PartialOrd<Identity> for Identity
[src]
impl PartialOrd<Identity> for Identity
[src]fn partial_cmp(&self, other: &Identity) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Identity) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Identity
[src]
impl StructuralEq for Identity
[src]
impl StructuralPartialEq for Identity
[src]
Auto Trait Implementations
impl RefUnwindSafe for Identity
impl Send for Identity
impl Sync for Identity
impl Unpin for Identity
impl UnwindSafe for Identity
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,