pub struct Encoder { /* private fields */ }micro-qr only.Expand description
Configures and encodes Micro QR Code symbols.
Implementations§
Source§impl MicroEncoder
impl MicroEncoder
Sourcepub const fn new(error_correction: MicroErrorCorrection) -> Self
pub const fn new(error_correction: MicroErrorCorrection) -> Self
Creates an encoder with automatic mask selection and all Micro QR Code versions.
Sourcepub const fn version(self, version: MicroVersion) -> Self
pub const fn version(self, version: MicroVersion) -> Self
Selects one exact Micro QR Code version.
Sourcepub const fn version_range(self, versions: RangeInclusive<MicroVersion>) -> Self
pub const fn version_range(self, versions: RangeInclusive<MicroVersion>) -> Self
Selects the inclusive Micro QR Code version range considered during encoding.
Sourcepub const fn mask(self, mask: MicroMask) -> Self
pub const fn mask(self, mask: MicroMask) -> Self
Forces an exact mask instead of selecting one automatically.
Sourcepub const fn boost_error_correction(self, boost: bool) -> Self
pub const fn boost_error_correction(self, boost: bool) -> Self
Enables or disables upgrading the error correction level when the selected version has room.
Sourcepub fn encode_bytes(
&self,
data: impl AsRef<[u8]>,
) -> Result<Symbol, EncodeError>
pub fn encode_bytes( &self, data: impl AsRef<[u8]>, ) -> Result<Symbol, EncodeError>
Encodes raw bytes with globally optimized modes supported by each candidate version.
Sourcepub fn encode_text(&self, text: impl AsRef<str>) -> Result<Symbol, EncodeError>
pub fn encode_text(&self, text: impl AsRef<str>) -> Result<Symbol, EncodeError>
Encodes text with globally optimized modes supported by each candidate version.
Sourcepub fn encode_to_qr_text<T: ToQRText + ?Sized>(
&self,
value: &T,
) -> Result<Symbol, EncodeError>
pub fn encode_to_qr_text<T: ToQRText + ?Sized>( &self, value: &T, ) -> Result<Symbol, EncodeError>
Encodes a value after converting it to its QR Code text representation.
Sourcepub fn encode_segments(
&self,
segments: &[Segment],
) -> Result<Symbol, EncodeError>
pub fn encode_segments( &self, segments: &[Segment], ) -> Result<Symbol, EncodeError>
Encodes explicit segments without changing their boundaries.
The segments are written as given, so avoid Byte segments holding E0 to EB in a symbol with Kanji segments, because readers could take them for Shift JIS lead bytes. An empty Numeric segment is left out, because Micro QR Code writes it with the same bits as the terminator.