pub struct QrCodeBuilder<D: AsRef<[u8]>> { /* private fields */ }Expand description
A builder for QrCode, offering ergonomic, chainable configuration.
Construct one with QrCode::builder. The builder delegates to the
existing constructors, so its output is identical to calling them directly.
Implementations§
Source§impl<D: AsRef<[u8]>> QrCodeBuilder<D>
impl<D: AsRef<[u8]>> QrCodeBuilder<D>
Sourcepub fn ec_level(self, ec_level: EcLevel) -> Self
pub fn ec_level(self, ec_level: EcLevel) -> Self
Sets the error correction level (default EcLevel::M).
Sourcepub fn version(self, version: Version) -> Self
pub fn version(self, version: Version) -> Self
Pins a specific QR Version. When set, build() behaves like
QrCode::with_version. If micro is also set, the
explicit version takes precedence.
Sourcepub fn micro(self, yes: bool) -> Self
pub fn micro(self, yes: bool) -> Self
Requests a Micro QR code (the smallest fitting Micro version), behaving
like QrCode::micro_with_error_correction_level when no explicit
version is set.
Sourcepub fn encoding_mode(self, mode: Mode) -> Self
pub fn encoding_mode(self, mode: Mode) -> Self
Hints the encoding Mode (e.g. Mode::Byte), bypassing automatic
mode optimization. When a version is also set it is
used directly; otherwise the smallest fitting version for that mode is
auto-selected.
The data must be encodable in the chosen mode: Mode::Kanji validates
its Shift-JIS pairs and Mode::Byte accepts anything, but
Mode::Numeric / Mode::Alphanumeric assume their input already
matches (as automatic optimization would never select them otherwise).
Sourcepub fn force_mode(self, mode: Mode) -> Self
pub fn force_mode(self, mode: Mode) -> Self
Forces a specific encoding Mode, bypassing automatic optimization.
This is an alias for encoding_mode, provided for
familiarity with the QR-code vocabulary.