WiegandFormat

Struct WiegandFormat 

Source
pub struct WiegandFormat {
    pub parity_even: usize,
    pub parity_odd: usize,
    pub facility_code: (usize, usize),
    pub card_number: (usize, usize),
}
Expand description

Structure of a Wiegand format. Wiegand encoding can vary depending on the manufacturer or implementation of access control in a facility.

Fields§

§parity_even: usize

Position of the even parity bit

§parity_odd: usize

Position of the odd parity bit

§facility_code: (usize, usize)

Facility code bit range denoted by: inclusive lower bound and non-inclusive upper bound

§card_number: (usize, usize)

Card number/identifier bit range denoted by: inclusive lower bound and non-inclusive upper bound

Implementations§

Source§

impl WiegandFormat

Source

pub fn decode(self, i: u32) -> Result<(u8, u16), WiegandError>

Decodes a (facility_code, card_number) tuple from an integer sourced from an RFID scan

Source

pub fn to_string(self, i: u32) -> String

assumes i is not padded

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.