pub struct QRCodeStyling { /* private fields */ }Expand description
Main QR code styling struct.
This is the primary entry point for creating styled QR codes.
§Example
use qr_code_styling::{QRCodeStyling, OutputFormat};
let qr = QRCodeStyling::builder()
.data("https://example.com")
.width(300)
.height(300)
.build()
.unwrap();
let svg = qr.render_svg().unwrap();Implementations§
Source§impl QRCodeStyling
impl QRCodeStyling
Sourcepub fn builder() -> QRCodeStylingBuilder
pub fn builder() -> QRCodeStylingBuilder
Create a new QRCodeStyling builder.
Sourcepub fn new(options: QRCodeStylingOptions) -> Result<Self>
pub fn new(options: QRCodeStylingOptions) -> Result<Self>
Create a new QRCodeStyling with the given options.
Sourcepub fn update(&mut self, data: &str) -> Result<&mut Self>
pub fn update(&mut self, data: &str) -> Result<&mut Self>
Update the data and regenerate the QR code.
Sourcepub fn render_svg(&self) -> Result<String>
pub fn render_svg(&self) -> Result<String>
Render the QR code as an SVG string.
Sourcepub fn render(&self, format: OutputFormat) -> Result<Vec<u8>>
pub fn render(&self, format: OutputFormat) -> Result<Vec<u8>>
Render the QR code in the specified format.
Sourcepub fn save<P: AsRef<Path>>(&self, path: P, format: OutputFormat) -> Result<()>
pub fn save<P: AsRef<Path>>(&self, path: P, format: OutputFormat) -> Result<()>
Save the QR code to a file.
Sourcepub fn module_count(&self) -> usize
pub fn module_count(&self) -> usize
Get the QR code module count.
Sourcepub fn options(&self) -> &QRCodeStylingOptions
pub fn options(&self) -> &QRCodeStylingOptions
Get the current options.
Sourcepub fn options_mut(&mut self) -> &mut QRCodeStylingOptions
pub fn options_mut(&mut self) -> &mut QRCodeStylingOptions
Get mutable reference to options (requires regeneration after).
Sourcepub fn regenerate(&mut self) -> Result<()>
pub fn regenerate(&mut self) -> Result<()>
Regenerate the QR matrix (call after modifying options).
Auto Trait Implementations§
impl Freeze for QRCodeStyling
impl RefUnwindSafe for QRCodeStyling
impl Send for QRCodeStyling
impl Sync for QRCodeStyling
impl Unpin for QRCodeStyling
impl UnwindSafe for QRCodeStyling
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
Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.