pub struct QRBuilder { /* private fields */ }
Expand description
Builder struct, makes it easier to create a QRCode
.
§Example
use fast_qr::QRBuilder;
use fast_qr::{Mask, ECL, Version};
// Creates a `QRCode` with a forced `version`, `ecl` and/or `mask`
let input = String::from("Hello World!");
let qr = QRBuilder::new(input)
// .version(Version::V05)
// .ecl(ECL::H)
// .mask(Mask::Checkerboard)
.build();
Implementations§
source§impl QRBuilder
impl QRBuilder
sourcepub fn new<I: Into<Vec<u8>>>(input: I) -> QRBuilder
pub fn new<I: Into<Vec<u8>>>(input: I) -> QRBuilder
Creates an instance of QRBuilder
with default parameters
sourcepub fn build(&self) -> Result<QRCode, QRCodeError>
pub fn build(&self) -> Result<QRCode, QRCodeError>
Computes a QRCode
with given parameters
§Errors
QRCodeError::EncodedData
ifinput
is too large to be encoded. See an online table for more info.QRCodeError::SpecifiedVersion
if specifiedversion
is too small to contain data
Auto Trait Implementations§
impl Freeze for QRBuilder
impl RefUnwindSafe for QRBuilder
impl Send for QRBuilder
impl Sync for QRBuilder
impl Unpin for QRBuilder
impl UnwindSafe for QRBuilder
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