Struct rifven::Rif[][src]

pub struct Rif { /* fields omitted */ }

Venezuelan RIF identifier

Anatomy

The following chart reviews the anatomy of a RIF identifier.


 X - XXXXXXXXX - X
 ^   ^________   ^
 A       B      C

A: Kind represents either the citizenship or the kind of entity behind the RIF identifier

B: The contributor/tax payer identifier. Must be 9 digits long

C: The check number for the RIF identifier

Implementations

impl Rif[src]

pub fn new(
    kind: Kind,
    identifier: u32,
    checksum_digit: u8
) -> Result<Self, Error>
[src]

Creates a new Rif instance with the provided kind, identifier and the checksum_digit

use rifven::{Kind, Rif};

let rif = Rif::new(Kind::Legal, 07013380, 5).unwrap();

assert_eq!(rif.kind(), Kind::Legal);
assert_eq!(rif.identifier(), 7013380);
assert_eq!(rif.checksum_digit(), 5);

pub fn kind(&self) -> Kind[src]

Retrieves the Kind of the current Rif

use rifven::{Kind, Rif};

let rif = Rif::new(Kind::Legal, 07013380, 5).unwrap();

assert_eq!(rif.kind(), Kind::Legal);

pub fn identifier(&self) -> u32[src]

Retrieves the identifier of the current Rif

use rifven::{Kind, Rif};

let rif = Rif::new(Kind::Legal, 07013380, 5).unwrap();

assert_eq!(rif.identifier(), 7013380);

pub fn checksum_digit(&self) -> u8[src]

Retrieves the check number of the current Rif

use rifven::{Kind, Rif};

let rif = Rif::new(Kind::Legal, 07013380, 5).unwrap();

assert_eq!(rif.checksum_digit(), 5);

pub fn calc_checksum_digit(kind: &Kind, identifier: u32) -> u8[src]

Calculates the checksum_digit for a provided RIF number

Trait Implementations

impl Clone for Rif[src]

impl Debug for Rif[src]

impl FromStr for Rif[src]

type Err = Error

The associated error which can be returned from parsing.

impl PartialEq<Rif> for Rif[src]

impl StructuralPartialEq for Rif[src]

Auto Trait Implementations

impl RefUnwindSafe for Rif

impl Send for Rif

impl Sync for Rif

impl Unpin for Rif

impl UnwindSafe for Rif

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.