Struct mini_functions::qr::QRCode
source · #[non_exhaustive]pub struct QRCode {
pub data: Vec<u8>,
}
Expand description
Re-exported main qrc
module from qrc for QR code generation.
QRCode is a structure that contains data in the form of a vector of
bytes.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.data: Vec<u8>
The data
field holds the data to be encoded in the QR code.
Implementations§
source§impl QRCode
impl QRCode
Implementation of QRCode structure.
sourcepub fn from_string(data: String) -> QRCode
pub fn from_string(data: String) -> QRCode
The from_string
method creates a new instance of the QRCode
struct by converting the given string data into a vector of
bytes
sourcepub fn from_bytes(data: Vec<u8>) -> QRCode
pub fn from_bytes(data: Vec<u8>) -> QRCode
Creates a new QRCode structure from a vector of bytes.
sourcepub fn to_png(&self, width: u32) -> ImageBuffer<Rgba<u8>, Vec<u8>>
pub fn to_png(&self, width: u32) -> ImageBuffer<Rgba<u8>, Vec<u8>>
Converts the QRCode structure to a PNG image.
sourcepub fn to_jpg(&self, width: u32) -> ImageBuffer<Rgba<u8>, Vec<u8>>
pub fn to_jpg(&self, width: u32) -> ImageBuffer<Rgba<u8>, Vec<u8>>
Converts the QRCode structure to a JPG image.
sourcepub fn to_gif(&self, width: u32) -> ImageBuffer<Rgba<u8>, Vec<u8>>
pub fn to_gif(&self, width: u32) -> ImageBuffer<Rgba<u8>, Vec<u8>>
Converts the QRCode structure to a GIF image.
sourcepub fn colorize(&self, color: Rgba<u8>) -> ImageBuffer<Rgba<u8>, Vec<u8>>
pub fn colorize(&self, color: Rgba<u8>) -> ImageBuffer<Rgba<u8>, Vec<u8>>
The colorize
method creates a new PNG image of the QR code
using the data stored in the QRCode and the given color value to
colorize the QR code.
sourcepub fn resize(&self, width: u32, height: u32) -> ImageBuffer<Rgba<u8>, Vec<u8>>
pub fn resize(&self, width: u32, height: u32) -> ImageBuffer<Rgba<u8>, Vec<u8>>
The resize
method creates a new PNG image of the QR code using
the data stored in the QRCode and the given width and height
values to resize the QR code.
sourcepub fn add_image_watermark(
img: &mut ImageBuffer<Rgba<u8>, Vec<u8>>,
watermark: &ImageBuffer<Rgba<u8>, Vec<u8>>
)
pub fn add_image_watermark( img: &mut ImageBuffer<Rgba<u8>, Vec<u8>>, watermark: &ImageBuffer<Rgba<u8>, Vec<u8>> )
The add_image_watermark
method adds a watermark to the given image.
Trait Implementations§
source§impl Ord for QRCode
impl Ord for QRCode
source§impl PartialEq for QRCode
impl PartialEq for QRCode
source§impl PartialOrd for QRCode
impl PartialOrd for QRCode
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for QRCode
impl StructuralEq for QRCode
impl StructuralPartialEq for QRCode
Auto Trait Implementations§
impl RefUnwindSafe for QRCode
impl Send for QRCode
impl Sync for QRCode
impl Unpin for QRCode
impl UnwindSafe for QRCode
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
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.