rxing/
encode_hints.rs

1/*
2 * Copyright 2008 ZXing authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17//package com.google.zxing;
18
19#![allow(deprecated)]
20
21use crate::{pdf417::encoder::Dimensions, Dimension};
22
23#[cfg(feature = "serde")]
24use serde::{Deserialize, Serialize};
25
26/**
27 * These are a set of hints that you may pass to Writers to specify their behavior.
28 *
29 * @author dswitkin@google.com (Daniel Switkin)
30 */
31#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
32#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
33pub enum EncodeHintType {
34    /**
35     * Specifies what degree of error correction to use, for example in QR Codes.
36     * Type depends on the encoder. For example for QR codes it's type
37     * {@link com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ErrorCorrectionLevel}.
38     * For Aztec it is of type {@link Integer}, representing the minimal percentage of error correction words.
39     * For PDF417 it is of type {@link Integer}, valid values being 0 to 8.
40     * In all cases, it can also be a {@link String} representation of the desired value as well.
41     * Note: an Aztec symbol should have a minimum of 25% EC words.
42     */
43    ERROR_CORRECTION,
44
45    /**
46     * Specifies what character encoding to use where applicable (type {@link String})
47     */
48    CHARACTER_SET,
49
50    /**
51     * Specifies the matrix shape for Data Matrix (type {@link com.google.zxing.datamatrix.encoder.SymbolShapeHint})
52     */
53    DATA_MATRIX_SHAPE,
54
55    /**
56     * Specifies whether to use compact mode for Data Matrix (type {@link Boolean}, or "true" or "false"
57     * {@link String } value).
58     * The compact encoding mode also supports the encoding of characters that are not in the ISO-8859-1
59     * character set via ECIs.
60     * Please note that in that case, the most compact character encoding is chosen for characters in
61     * the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
62     * support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
63     * means of the {@link #CHARACTER_SET} encoding hint.
64     * Compact encoding also provides GS1-FNC1 support when {@link #GS1_FORMAT} is selected. In this case
65     * group-separator character (ASCII 29 decimal) can be used to encode the positions of FNC1 codewords
66     * for the purpose of delimiting AIs.
67     * This option and {@link #FORCE_C40} are mutually exclusive.
68     */
69    DATA_MATRIX_COMPACT,
70
71    /**
72     * Specifies a minimum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
73     *
74     * @deprecated use width/height params in
75     * {@link com.google.zxing.datamatrix.DataMatrixWriter#encode(String, BarcodeFormat, int, int)}
76     */
77    #[deprecated]
78    MIN_SIZE,
79
80    /**
81     * Specifies a maximum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
82     *
83     * @deprecated without replacement
84     */
85    #[deprecated]
86    MAX_SIZE,
87
88    /**
89     * Specifies margin, in pixels, to use when generating the barcode. The meaning can vary
90     * by format; for example it controls margin before and after the barcode horizontally for
91     * most 1D formats. (Type {@link Integer}, or {@link String} representation of the integer value).
92     */
93    MARGIN,
94
95    /**
96     * Specifies whether to use compact mode for PDF417 (type {@link Boolean}, or "true" or "false"
97     * {@link String} value).
98     */
99    PDF417_COMPACT,
100
101    /**
102     * Specifies what compaction mode to use for PDF417 (type
103     * {@link com.google.zxing.pdf417.encoder.Compaction Compaction} or {@link String} value of one of its
104     * enum values).
105     */
106    PDF417_COMPACTION,
107
108    /**
109     * Specifies the minimum and maximum number of rows and columns for PDF417 (type
110     * {@link com.google.zxing.pdf417.encoder.Dimensions Dimensions}).
111     */
112    PDF417_DIMENSIONS,
113
114    /**
115     * Specifies whether to automatically insert ECIs when encoding PDF417 (type {@link Boolean}, or "true" or "false"
116     * {@link String} value).
117     * Please note that in that case, the most compact character encoding is chosen for characters in
118     * the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
119     * support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
120     * means of the {@link #CHARACTER_SET} encoding hint.
121     */
122    PDF417_AUTO_ECI,
123
124    /**
125     * Specifies the required number of layers for an Aztec code.
126     * A negative number (-1, -2, -3, -4) specifies a compact Aztec code.
127     * 0 indicates to use the minimum number of layers (the default).
128     * A positive number (1, 2, .. 32) specifies a normal (non-compact) Aztec code.
129     * (Type {@link Integer}, or {@link String} representation of the integer value).
130     */
131    AZTEC_LAYERS,
132
133    /**
134     * Specifies the exact version of QR code to be encoded.
135     * (Type {@link Integer}, or {@link String} representation of the integer value).
136     */
137    QR_VERSION,
138
139    /**
140     * Specifies the QR code mask pattern to be used. Allowed values are
141     * 0..QRCode.NUM_MASK_PATTERNS-1. By default the code will automatically select
142     * the optimal mask pattern.
143     * * (Type {@link Integer}, or {@link String} representation of the integer value).
144     */
145    QR_MASK_PATTERN,
146
147    /**
148     * Specifies whether to use compact mode for QR code (type {@link Boolean}, or "true" or "false"
149     * {@link String } value).
150     * Please note that when compaction is performed, the most compact character encoding is chosen
151     * for characters in the input that are not in the ISO-8859-1 character set. Based on experience,
152     * some scanners do not support encodings like cp-1256 (Arabic). In such cases the encoding can
153     * be forced to UTF-8 by means of the {@link #CHARACTER_SET} encoding hint.
154     */
155    QR_COMPACT,
156
157    /**
158     * Specifies whether the data should be encoded to the GS1 standard (type {@link Boolean}, or "true" or "false"
159     * {@link String } value).
160     */
161    GS1_FORMAT,
162
163    /**
164     * Forces which encoding will be used. Currently only used for Code-128 code sets (Type {@link String}).
165     * Valid values are "A", "B", "C".
166     * This option and {@link #CODE128_COMPACT} are mutually exclusive.
167     */
168    FORCE_CODE_SET,
169
170    /**
171     * Forces C40 encoding for data-matrix (type {@link Boolean}, or "true" or "false") {@link String } value). This
172     * option and {@link #DATA_MATRIX_COMPACT} are mutually exclusive.
173     */
174    FORCE_C40,
175
176    /**
177     * Specifies whether to use compact mode for Code-128 code (type {@link Boolean}, or "true" or "false"
178     * {@link String } value).
179     * This can yield slightly smaller bar codes. This option and {@link #FORCE_CODE_SET} are mutually
180     * exclusive.
181     */
182    CODE128_COMPACT,
183
184    /*
185     * Will translate the numeric values received by the Telepen writer into the Telepen Alphanumeric form.
186     */
187    TELEPEN_AS_NUMERIC,
188}
189
190#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
191pub enum EncodeHintValue {
192    /**
193     * Specifies what degree of error correction to use, for example in QR Codes.
194     * Type depends on the encoder. For example for QR codes it's type
195     * {@link com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ErrorCorrectionLevel}.
196     * For Aztec it is of type {@link Integer}, representing the minimal percentage of error correction words.
197     * For PDF417 it is of type {@link Integer}, valid values being 0 to 8.
198     * In all cases, it can also be a {@link String} representation of the desired value as well.
199     * Note: an Aztec symbol should have a minimum of 25% EC words.
200     */
201    ErrorCorrection(String),
202
203    /**
204     * Specifies what character encoding to use where applicable (type {@link String})
205     */
206    CharacterSet(String),
207
208    /**
209     * Specifies the matrix shape for Data Matrix (type {@link com.google.zxing.datamatrix.encoder.SymbolShapeHint})
210     */
211    DataMatrixShape(crate::datamatrix::encoder::SymbolShapeHint),
212
213    /**
214     * Specifies whether to use compact mode for Data Matrix (type {@link Boolean}, or "true" or "false"
215     * {@link String } value).
216     * The compact encoding mode also supports the encoding of characters that are not in the ISO-8859-1
217     * character set via ECIs.
218     * Please note that in that case, the most compact character encoding is chosen for characters in
219     * the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
220     * support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
221     * means of the {@link #CHARACTER_SET} encoding hint.
222     * Compact encoding also provides GS1-FNC1 support when {@link #GS1_FORMAT} is selected. In this case
223     * group-separator character (ASCII 29 decimal) can be used to encode the positions of FNC1 codewords
224     * for the purpose of delimiting AIs.
225     * This option and {@link #FORCE_C40} are mutually exclusive.
226     */
227    DataMatrixCompact(bool),
228
229    /**
230     * Specifies a minimum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
231     *
232     * @deprecated use width/height params in
233     * {@link com.google.zxing.datamatrix.DataMatrixWriter#encode(String, BarcodeFormat, int, int)}
234     */
235    #[deprecated]
236    MinSize(Dimension),
237
238    /**
239     * Specifies a maximum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
240     *
241     * @deprecated without replacement
242     */
243    #[deprecated]
244    MaxSize(Dimension),
245
246    /**
247     * Specifies margin, in pixels, to use when generating the barcode. The meaning can vary
248     * by format; for example it controls margin before and after the barcode horizontally for
249     * most 1D formats. (Type {@link Integer}, or {@link String} representation of the integer value).
250     */
251    Margin(String),
252
253    /**
254     * Specifies whether to use compact mode for PDF417 (type {@link Boolean}, or "true" or "false"
255     * {@link String} value).
256     */
257    Pdf417Compact(String),
258
259    /**
260     * Specifies what compaction mode to use for PDF417 (type
261     * {@link com.google.zxing.pdf417.encoder.Compaction Compaction} or {@link String} value of one of its
262     * enum values).
263     */
264    Pdf417Compaction(String),
265
266    /**
267     * Specifies the minimum and maximum number of rows and columns for PDF417 (type
268     * {@link com.google.zxing.pdf417.encoder.Dimensions Dimensions}).
269     */
270    Pdf417Dimensions(Dimensions),
271
272    /**
273     * Specifies whether to automatically insert ECIs when encoding PDF417 (type {@link Boolean}, or "true" or "false"
274     * {@link String} value).
275     * Please note that in that case, the most compact character encoding is chosen for characters in
276     * the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
277     * support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
278     * means of the {@link #CHARACTER_SET} encoding hint.
279     */
280    Pdf417AutoEci(String),
281
282    /**
283     * Specifies the required number of layers for an Aztec code.
284     * A negative number (-1, -2, -3, -4) specifies a compact Aztec code.
285     * 0 indicates to use the minimum number of layers (the default).
286     * A positive number (1, 2, .. 32) specifies a normal (non-compact) Aztec code.
287     * (Type {@link Integer}, or {@link String} representation of the integer value).
288     */
289    AztecLayers(i32),
290
291    /**
292     * Specifies the exact version of QR code to be encoded.
293     * (Type {@link Integer}, or {@link String} representation of the integer value).
294     */
295    QrVersion(String),
296
297    /**
298     * Specifies the QR code mask pattern to be used. Allowed values are
299     * 0..QRCode.NUM_MASK_PATTERNS-1. By default the code will automatically select
300     * the optimal mask pattern.
301     * * (Type {@link Integer}, or {@link String} representation of the integer value).
302     */
303    QrMaskPattern(String),
304
305    /**
306     * Specifies whether to use compact mode for QR code (type {@link Boolean}, or "true" or "false"
307     * {@link String } value).
308     * Please note that when compaction is performed, the most compact character encoding is chosen
309     * for characters in the input that are not in the ISO-8859-1 character set. Based on experience,
310     * some scanners do not support encodings like cp-1256 (Arabic). In such cases the encoding can
311     * be forced to UTF-8 by means of the {@link #CHARACTER_SET} encoding hint.
312     */
313    QrCompact(String),
314
315    /**
316     * Specifies whether the data should be encoded to the GS1 standard (type {@link Boolean}, or "true" or "false"
317     * {@link String } value).
318     */
319    Gs1Format(bool),
320
321    /**
322     * Forces which encoding will be used. Currently only used for Code-128 code sets (Type {@link String}).
323     * Valid values are "A", "B", "C".
324     * This option and {@link #CODE128_COMPACT} are mutually exclusive.
325     */
326    ForceCodeSet(String),
327
328    /**
329     * Forces C40 encoding for data-matrix (type {@link Boolean}, or "true" or "false") {@link String } value). This
330     * option and {@link #DATA_MATRIX_COMPACT} are mutually exclusive.
331     */
332    ForceC40(bool),
333
334    /**
335     * Specifies whether to use compact mode for Code-128 code (type {@link Boolean}, or "true" or "false"
336     * {@link String } value).
337     * This can yield slightly smaller bar codes. This option and {@link #FORCE_CODE_SET} are mutually
338     * exclusive.
339     */
340    Code128Compact(bool),
341
342    /**
343     * Translate the numeric values received by the Telepen reader into the Telepen Alphaumeric form; use {@link Boolean#TRUE}.
344     */
345    TelepenAsNumeric(bool),
346}
347
348#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
349#[derive(Debug, Default, Clone)]
350pub struct EncodeHints {
351    /**
352     * Specifies what degree of error correction to use, for example in QR Codes.
353     * Type depends on the encoder. For example for QR codes it's type
354     * {@link com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ErrorCorrectionLevel}.
355     * For Aztec it is of type {@link Integer}, representing the minimal percentage of error correction words.
356     * For PDF417 it is of type {@link Integer}, valid values being 0 to 8.
357     * In all cases, it can also be a {@link String} representation of the desired value as well.
358     * Note: an Aztec symbol should have a minimum of 25% EC words.
359     */
360    pub ErrorCorrection: Option<String>,
361
362    /**
363     * Specifies what character encoding to use where applicable (type {@link String})
364     */
365    pub CharacterSet: Option<String>,
366
367    /**
368     * Specifies the matrix shape for Data Matrix (type {@link com.google.zxing.datamatrix.encoder.SymbolShapeHint})
369     */
370    pub DataMatrixShape: Option<crate::datamatrix::encoder::SymbolShapeHint>,
371
372    /**
373     * Specifies whether to use compact mode for Data Matrix (type {@link Boolean}, or "true" or "false"
374     * {@link String } value).
375     * The compact encoding mode also supports the encoding of characters that are not in the ISO-8859-1
376     * character set via ECIs.
377     * Please note that in that case, the most compact character encoding is chosen for characters in
378     * the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
379     * support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
380     * means of the {@link #CHARACTER_SET} encoding hint.
381     * Compact encoding also provides GS1-FNC1 support when {@link #GS1_FORMAT} is selected. In this case
382     * group-separator character (ASCII 29 decimal) can be used to encode the positions of FNC1 codewords
383     * for the purpose of delimiting AIs.
384     * This option and {@link #FORCE_C40} are mutually exclusive.
385     */
386    pub DataMatrixCompact: Option<bool>,
387
388    /**
389     * Specifies a minimum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
390     *
391     * @deprecated use width/height params in
392     * {@link com.google.zxing.datamatrix.DataMatrixWriter#encode(String, BarcodeFormat, int, int)}
393     */
394    #[deprecated]
395    pub MinSize: Option<Dimension>,
396
397    /**
398     * Specifies a maximum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
399     *
400     * @deprecated without replacement
401     */
402    #[deprecated]
403    pub MaxSize: Option<Dimension>,
404
405    /**
406     * Specifies margin, in pixels, to use when generating the barcode. The meaning can vary
407     * by format; for example it controls margin before and after the barcode horizontally for
408     * most 1D formats. (Type {@link Integer}, or {@link String} representation of the integer value).
409     */
410    pub Margin: Option<String>,
411
412    /**
413     * Specifies whether to use compact mode for PDF417 (type {@link Boolean}, or "true" or "false"
414     * {@link String} value).
415     */
416    pub Pdf417Compact: Option<String>,
417
418    /**
419     * Specifies what compaction mode to use for PDF417 (type
420     * {@link com.google.zxing.pdf417.encoder.Compaction Compaction} or {@link String} value of one of its
421     * enum values).
422     */
423    pub Pdf417Compaction: Option<String>,
424
425    /**
426     * Specifies the minimum and maximum number of rows and columns for PDF417 (type
427     * {@link com.google.zxing.pdf417.encoder.Dimensions Dimensions}).
428     */
429    pub Pdf417Dimensions: Option<Dimensions>,
430
431    /**
432     * Specifies whether to automatically insert ECIs when encoding PDF417 (type {@link Boolean}, or "true" or "false"
433     * {@link String} value).
434     * Please note that in that case, the most compact character encoding is chosen for characters in
435     * the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
436     * support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
437     * means of the {@link #CHARACTER_SET} encoding hint.
438     */
439    pub Pdf417AutoEci: Option<String>,
440
441    /**
442     * Specifies the required number of layers for an Aztec code.
443     * A negative number (-1, -2, -3, -4) specifies a compact Aztec code.
444     * 0 indicates to use the minimum number of layers (the default).
445     * A positive number (1, 2, .. 32) specifies a normal (non-compact) Aztec code.
446     * (Type {@link Integer}, or {@link String} representation of the integer value).
447     */
448    pub AztecLayers: Option<i32>,
449
450    /**
451     * Specifies the exact version of QR code to be encoded.
452     * (Type {@link Integer}, or {@link String} representation of the integer value).
453     */
454    pub QrVersion: Option<String>,
455
456    /**
457     * Specifies the QR code mask pattern to be used. Allowed values are
458     * 0..QRCode.NUM_MASK_PATTERNS-1. By default the code will automatically select
459     * the optimal mask pattern.
460     * * (Type {@link Integer}, or {@link String} representation of the integer value).
461     */
462    pub QrMaskPattern: Option<String>,
463
464    /**
465     * Specifies whether to use compact mode for QR code (type {@link Boolean}, or "true" or "false"
466     * {@link String } value).
467     * Please note that when compaction is performed, the most compact character encoding is chosen
468     * for characters in the input that are not in the ISO-8859-1 character set. Based on experience,
469     * some scanners do not support encodings like cp-1256 (Arabic). In such cases the encoding can
470     * be forced to UTF-8 by means of the {@link #CHARACTER_SET} encoding hint.
471     */
472    pub QrCompact: Option<String>,
473
474    /**
475     * Specifies whether the data should be encoded to the GS1 standard (type {@link Boolean}, or "true" or "false"
476     * {@link String } value).
477     */
478    pub Gs1Format: Option<bool>,
479
480    /**
481     * Forces which encoding will be used. Currently only used for Code-128 code sets (Type {@link String}).
482     * Valid values are "A", "B", "C".
483     * This option and {@link #CODE128_COMPACT} are mutually exclusive.
484     */
485    pub ForceCodeSet: Option<String>,
486
487    /**
488     * Forces C40 encoding for data-matrix (type {@link Boolean}, or "true" or "false") {@link String } value). This
489     * option and {@link #DATA_MATRIX_COMPACT} are mutually exclusive.
490     */
491    pub ForceC40: Option<bool>,
492
493    /**
494     * Specifies whether to use compact mode for Code-128 code (type {@link Boolean}, or "true" or "false"
495     * {@link String } value).
496     * This can yield slightly smaller bar codes. This option and {@link #FORCE_CODE_SET} are mutually
497     * exclusive.
498     */
499    pub Code128Compact: Option<bool>,
500
501    /**
502     * Translate the numeric values received by the Telepen reader into the Telepen Alphaumeric form; use {@link Boolean#TRUE}.
503     */
504    pub TelepenAsNumeric: Option<bool>,
505}
506
507impl From<super::EncodingHintDictionary> for EncodeHints {
508    fn from(value: super::EncodingHintDictionary) -> Self {
509        let mut new_self = Self::default();
510
511        for (_, v) in value.into_iter() {
512            match v {
513                EncodeHintValue::ErrorCorrection(v) => new_self.ErrorCorrection = Some(v),
514                EncodeHintValue::CharacterSet(v) => new_self.CharacterSet = Some(v),
515                EncodeHintValue::DataMatrixShape(v) => new_self.DataMatrixShape = Some(v),
516                EncodeHintValue::DataMatrixCompact(v) => new_self.DataMatrixCompact = Some(v),
517                EncodeHintValue::MinSize(v) => new_self.MinSize = Some(v),
518                EncodeHintValue::MaxSize(v) => new_self.MaxSize = Some(v),
519                EncodeHintValue::Margin(v) => new_self.Margin = Some(v),
520                EncodeHintValue::Pdf417Compact(v) => new_self.Pdf417Compact = Some(v),
521                EncodeHintValue::Pdf417Compaction(v) => new_self.Pdf417Compaction = Some(v),
522                EncodeHintValue::Pdf417Dimensions(v) => new_self.Pdf417Dimensions = Some(v),
523                EncodeHintValue::Pdf417AutoEci(v) => new_self.Pdf417AutoEci = Some(v),
524                EncodeHintValue::AztecLayers(v) => new_self.AztecLayers = Some(v),
525                EncodeHintValue::QrVersion(v) => new_self.QrVersion = Some(v),
526                EncodeHintValue::QrMaskPattern(v) => new_self.QrMaskPattern = Some(v),
527                EncodeHintValue::QrCompact(v) => new_self.QrCompact = Some(v),
528                EncodeHintValue::Gs1Format(v) => new_self.Gs1Format = Some(v),
529                EncodeHintValue::ForceCodeSet(v) => new_self.ForceCodeSet = Some(v),
530                EncodeHintValue::ForceC40(v) => new_self.ForceC40 = Some(v),
531                EncodeHintValue::Code128Compact(v) => new_self.Code128Compact = Some(v),
532                EncodeHintValue::TelepenAsNumeric(v) => new_self.TelepenAsNumeric = Some(v),
533            }
534        }
535
536        new_self
537    }
538}
539
540impl EncodeHints {
541    pub fn with(mut self, hint: EncodeHintValue) -> Self {
542        match hint {
543            EncodeHintValue::ErrorCorrection(v) => self.ErrorCorrection = Some(v),
544            EncodeHintValue::CharacterSet(v) => self.CharacterSet = Some(v),
545            EncodeHintValue::DataMatrixShape(v) => self.DataMatrixShape = Some(v),
546            EncodeHintValue::DataMatrixCompact(v) => self.DataMatrixCompact = Some(v),
547            EncodeHintValue::MinSize(v) => self.MinSize = Some(v),
548            EncodeHintValue::MaxSize(v) => self.MaxSize = Some(v),
549            EncodeHintValue::Margin(v) => self.Margin = Some(v),
550            EncodeHintValue::Pdf417Compact(v) => self.Pdf417Compact = Some(v),
551            EncodeHintValue::Pdf417Compaction(v) => self.Pdf417Compaction = Some(v),
552            EncodeHintValue::Pdf417Dimensions(v) => self.Pdf417Dimensions = Some(v),
553            EncodeHintValue::Pdf417AutoEci(v) => self.Pdf417AutoEci = Some(v),
554            EncodeHintValue::AztecLayers(v) => self.AztecLayers = Some(v),
555            EncodeHintValue::QrVersion(v) => self.QrVersion = Some(v),
556            EncodeHintValue::QrMaskPattern(v) => self.QrMaskPattern = Some(v),
557            EncodeHintValue::QrCompact(v) => self.QrCompact = Some(v),
558            EncodeHintValue::Gs1Format(v) => self.Gs1Format = Some(v),
559            EncodeHintValue::ForceCodeSet(v) => self.ForceCodeSet = Some(v),
560            EncodeHintValue::ForceC40(v) => self.ForceC40 = Some(v),
561            EncodeHintValue::Code128Compact(v) => self.Code128Compact = Some(v),
562            EncodeHintValue::TelepenAsNumeric(v) => self.TelepenAsNumeric = Some(v),
563        };
564        self
565    }
566}