[][src]Struct bardecoder::util::qr::QRData

pub struct QRData {
    pub data: Vec<u8>,
    pub version: u32,
    pub side: u32,
}

QR Data extracted from the source image

While the data is still pixels of value 0/255, using the index will convert it into 1's (pixel 0) and 0's (pixel 255)

Example

use bardecoder::util::qr::QRData;

let mut data = vec![0; 21 * 21];
data[21 * 21 - 1] = 255;
let qr_data = QRData::new(data, 1);

assert_eq!(qr_data.version, 1);
assert_eq!(qr_data.side, 21);
assert_eq!(qr_data[[0, 0]], 1);
assert_eq!(qr_data[[20, 20]], 0);

Fields

data: Vec<u8>

QR Pixel Data in side x side pixels, stored in row major order. Using the provided index will convert into 1's and 0's.

version: u32

Version of the QR Code, 1 being the smallest, 40 the largest

side: u32

Side in pixels of the QR square

Methods

impl QRData[src]

pub fn new(data: Vec<u8>, version: u32) -> QRData[src]

Create a new QRData object with the provided data and version. side will be calculated automatically.

Trait Implementations

impl Debug for QRData[src]

impl Decode<QRData, QRError> for QRDecoder[src]

impl Extract<ImageBuffer<Luma<u8>, Vec<u8>>, QRLocation, QRData, QRError> for QRExtractor[src]

impl Index<[u32; 2]> for QRData[src]

type Output = u8

The returned type after indexing.

Auto Trait Implementations

impl RefUnwindSafe for QRData

impl Send for QRData

impl Sync for QRData

impl Unpin for QRData

impl UnwindSafe for QRData

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> SetParameter for T

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.