pub fn quirc_decode(code: &QuircCode) -> Result<QuircData> {
    if (code.size - 17) % 4 != 0 {
        return Err(DecodeError::InvalidGridSize);
    }

    let version = (code.size - 17) / 4;

    if version < 1 || version > QUIRC_MAX_VERSION as i32 {
        return Err(DecodeError::InvalidVersion);
    }

    let mut data = QuircData {
        version,
        ..Default::default()
    };

    // Read format information -- try both locations
    read_format(code, &mut data, 0).or_else(|_| read_format(code, &mut data, 1))?;

    let mut ds = read_data(code, &data);
    codestream_ecc(&mut data, &mut ds)?;

    decode_payload(&mut data, &mut ds)?;

    Ok(data)
}
/// Decode a QR-code, returning the payload data.
Decode a QR-code, returning the payload data.
Decode a QR - code returning the payload data .
pub fn quirc_decode(code: &QuircCode) -> Result<QuircData> {
    if (code.size - 17) % 4 != 0 {
        return Err(DecodeError::InvalidGridSize);
    }
    let version = (code.size - 17) / 4;
    if version < 1 || version > QUIRC_MAX_VERSION as i32 {
        return Err(DecodeError::InvalidVersion);
    }
    let mut data = QuircData {
        version,
        ..Default::default()
    };
    // Read format information -- try both locations
    read_format(code, &mut data, 0).or_else(|_| read_format(code, &mut data, 1))?;
    let mut ds = read_data(code, &data);
    codestream_ecc(&mut data, &mut ds)?;
    decode_payload(&mut data, &mut ds)?;
    Ok(data)
}
pub fn quirc_decode ( code : & QuircCode ) -> Result < QuircData > { if ( code . size - 17 ) % 4 != 0 { return Err ( DecodeError :: InvalidGridSize ) ; } let version = ( code . size - 17 ) / 4 ; if version < 1 || version > QUIRC_MAX_VERSION as i32 { return Err ( DecodeError :: InvalidVersion ) ; } let mut data = QuircData { version , .. Default :: default ( ) } ; // Read format information -- try both locations read_format ( code , & mut data , 0 ) . or_else ( | _ | read_format ( code , & mut data , 1 ) ) ? ; let mut ds = read_data ( code , & data ) ; codestream_ecc ( & mut data , & mut ds ) ? ; decode_payload ( & mut data , & mut ds ) ? ; Ok ( data ) }
Decode a QR-code, returning the payload data.
Decode a QR - code returning the payload data .
code
&QuircCode
code
&QuircCode