pub struct Encoder { /* private fields */ }Available on crate feature
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.
Trait Implementations§
Source§impl Clone for MicroEncoder
impl Clone for MicroEncoder
Source§fn clone(&self) -> MicroEncoder
fn clone(&self) -> MicroEncoder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MicroEncoder
impl RefUnwindSafe for MicroEncoder
impl Send for MicroEncoder
impl Sync for MicroEncoder
impl Unpin for MicroEncoder
impl UnsafeUnpin for MicroEncoder
impl UnwindSafe for MicroEncoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more