1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! GS1 DataBar (formerly RSS) linear symbologies.
//!
//! Layout:
//! - `tables` — the ISO/IEC 24724:2011 specification tables and the GTIN check digit.
//! - `widths` — the combinatorial width <-> value algorithms (Annex B).
//! - `encode` — [`Symbol`] -> [`LinearPattern`].
//! - `decode` — [`LinearPattern`] -> [`Symbol`].
//!
//! ## Implemented
//! - **GS1 DataBar Omnidirectional** ([`Symbology::DataBarOmni`], RSS-14): a
//! 14-digit GTIN, 96 modules wide. Also covers Truncated, whose module pattern
//! is identical (it differs only in printed height, which this crate's abstract
//! module output does not carry).
//! - **GS1 DataBar Limited** ([`Symbology::DataBarLimited`]): a GTIN with
//! indicator digit 0 or 1, 79 modules wide.
//! - **GS1 DataBar Expanded** ([`Symbology::DataBarExpanded`], RSS Expanded): a GS1
//! element string of Application Identifier data, encoded with the general-purpose
//! compaction (§7.2.5) into a variable number of finder patterns and symbol
//! characters. Encoding methods 1 and 2 are produced; the weight/date/price
//! shortcut methods 3–14 are not (a spec-valid choice; see the `expanded` module).
//!
//! ## Not yet implemented
//! - All stacked variants (Stacked, Stacked Omnidirectional, Expanded Stacked)
//! return [`Error::Unsupported`].
//!
//! ## Lossless model
//! Omnidirectional and Limited encode a canonical 14-digit GTIN (13-digit body plus
//! its GS1 mod-10 check digit) as a single [`Segment::numeric`]. Expanded stores its
//! reduced element string as a single [`Segment::byte`]. In every case decoding
//! recovers the exact segment(s), so `encode(decode(x)) == x` byte-for-byte.
//!
//! [`Symbol`]: crate::Symbol
//! [`Segment::numeric`]: crate::segment::Segment::numeric
//! [`Segment::byte`]: crate::segment::Segment::byte
//! [`LinearPattern`]: crate::output::LinearPattern
//! [`Error::Unsupported`]: crate::error::Error::Unsupported
//! [`Symbology::DataBarOmni`]: crate::symbology::Symbology::DataBarOmni
//! [`Symbology::DataBarLimited`]: crate::symbology::Symbology::DataBarLimited
//! [`Symbology::DataBarExpanded`]: crate::symbology::Symbology::DataBarExpanded
pub use DataBarDecoder;
pub use DataBarEncoder;
/// Which member of the GS1 DataBar family a symbol is.
/// Parameters required to re-encode a GS1 DataBar symbol identically.
///
/// The payload (the 14-digit GTIN) lives in the symbol's segments; the only
/// re-encoding parameter is which family member produced it.