#[non_exhaustive]pub struct GrayPixels<'a> { /* private fields */ }Expand description
A borrowed grayscale (luma) pixel view: the universal input to a
QrDecoder.
One byte per pixel, row-major, 0 = black / 255 = white. Decoupled from
the image crate so custom decoders need no image dependency.
Implementations§
Source§impl<'a> GrayPixels<'a>
impl<'a> GrayPixels<'a>
Sourcepub fn new(width: u32, height: u32, data: &'a [u8]) -> Self
pub fn new(width: u32, height: u32, data: &'a [u8]) -> Self
Creates a view over data (which must hold width * height bytes).
Sourcepub fn try_new(
width: u32,
height: u32,
data: &'a [u8],
) -> Result<Self, GrayPixelsError>
pub fn try_new( width: u32, height: u32, data: &'a [u8], ) -> Result<Self, GrayPixelsError>
Creates a view after validating its dimensions and buffer length.
Zero-area dimensions are accepted when the buffer is empty. A decoder may require a non-empty image even when this view is valid.
§Errors
Returns GrayPixelsError::DimensionsOverflow if the pixel count cannot
be represented by a byte slice on this target, or
GrayPixelsError::BufferLengthMismatch if data.len() differs from
width * height.
Trait Implementations§
Source§impl<'a> Clone for GrayPixels<'a>
impl<'a> Clone for GrayPixels<'a>
impl<'a> Copy for GrayPixels<'a>
Auto Trait Implementations§
impl<'a> Forget for GrayPixels<'a>
impl<'a> Freeze for GrayPixels<'a>
impl<'a> Move for GrayPixels<'a>
impl<'a> RefUnwindSafe for GrayPixels<'a>
impl<'a> Send for GrayPixels<'a>
impl<'a> Sync for GrayPixels<'a>
impl<'a> Unpin for GrayPixels<'a>
impl<'a> UnsafeUnpin for GrayPixels<'a>where
&'a [u8]: UnsafeUnpin,
impl<'a> UnwindSafe for GrayPixels<'a>where
&'a [u8]: UnwindSafe,
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