#[non_exhaustive]pub struct StructuredAppend<'a> { /* private fields */ }Expand description
A Structured Append sequence builder: splits one payload across 2..=16 QR symbols.
Construct with StructuredAppend::new, then call
StructuredAppend::encode to emit the symbols. Every emitted symbol is a
complete, independently-scannable QR code that also carries the Structured
Append header, so a compliant reader knows how the symbols belong together.
Implementations§
Source§impl<'a> StructuredAppend<'a>
impl<'a> StructuredAppend<'a>
Sourcepub fn new(symbols: u8, payload: &'a [u8]) -> QrResult<Self>
pub fn new(symbols: u8, payload: &'a [u8]) -> QrResult<Self>
Creates a builder that will split payload across symbols QR symbols.
symbols must be in 2..=16 (per ISO/IEC 18004 §7.4 a Structured
Append sequence has at least two symbols). The parity byte (the XOR of
every payload byte) is computed once here and reused for every symbol.
§Errors
Returns QrError::InvalidStructuredAppend if symbols is not in
2..=16.
use qrcode_rs::structured_append::StructuredAppend;
use qrcode_rs::EcLevel;
let sa = StructuredAppend::new(3, b"split across three symbols")?;
let codes = sa.encode(EcLevel::M)?;
assert_eq!(codes.len(), 3);Sourcepub const fn parity(&self) -> u8
pub const fn parity(&self) -> u8
The Structured Append parity byte (the XOR of every payload byte), stored identically in every emitted symbol so a reader can verify it has reassembled the right group.
Sourcepub fn encode(&self, ec: EcLevel) -> QrResult<Vec<QrCode>>
pub fn encode(&self, ec: EcLevel) -> QrResult<Vec<QrCode>>
Encodes the payload into Self::symbols QR codes.
The payload is split as evenly as possible (the last symbol may be
shorter). Each symbol is encoded at the smallest version that fits its
chunk plus the 20-bit Structured Append header, at error-correction
level ec. Symbols in a sequence may therefore differ in version — this
is permitted by the standard.
§Errors
Returns QrError::DataTooLong if any chunk cannot fit even version 40
at the requested error-correction level.
Trait Implementations§
Source§impl<'a> Clone for StructuredAppend<'a>
impl<'a> Clone for StructuredAppend<'a>
Source§fn clone(&self) -> StructuredAppend<'a>
fn clone(&self) -> StructuredAppend<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more