pub struct ModuleView<'a> { /* private fields */ }Expand description
Borrowed row-major view over a read-only QR module grid.
ModuleView is useful for adapters and tests that already have a module
slice and need to pass it through the shared ModuleSource abstraction
without allocating or implementing a bespoke wrapper type.
Implementations§
Source§impl<'a> ModuleView<'a>
impl<'a> ModuleView<'a>
Sourcepub const fn new(modules: &'a [Color], width: usize) -> Option<Self>
pub const fn new(modules: &'a [Color], width: usize) -> Option<Self>
Creates a square module view from a row-major module slice.
Returns None when width == 0 or modules.len() != width * width.
Sourcepub const fn new_rect(
modules: &'a [Color],
width: usize,
height: usize,
) -> Option<Self>
pub const fn new_rect( modules: &'a [Color], width: usize, height: usize, ) -> Option<Self>
Creates a rectangular module view from a row-major module slice.
This keeps the same zero-copy storage contract as ModuleView::new,
but allows callers to borrow a contiguous range of full rows.
Returns None when either dimension is zero or when
modules.len() != width * height.
Trait Implementations§
Source§impl<'a> Clone for ModuleView<'a>
impl<'a> Clone for ModuleView<'a>
Source§fn clone(&self) -> ModuleView<'a>
fn clone(&self) -> ModuleView<'a>
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 moreimpl<'a> Copy for ModuleView<'a>
Source§impl<'a> Debug for ModuleView<'a>
impl<'a> Debug for ModuleView<'a>
impl<'a> Eq for ModuleView<'a>
Source§impl ModuleSource for ModuleView<'_>
impl ModuleSource for ModuleView<'_>
Source§impl<'a> PartialEq for ModuleView<'a>
impl<'a> PartialEq for ModuleView<'a>
impl<'a> StructuralPartialEq for ModuleView<'a>
Auto Trait Implementations§
impl<'a> Freeze for ModuleView<'a>
impl<'a> RefUnwindSafe for ModuleView<'a>
impl<'a> Send for ModuleView<'a>
impl<'a> Sync for ModuleView<'a>
impl<'a> Unpin for ModuleView<'a>
impl<'a> UnsafeUnpin for ModuleView<'a>
impl<'a> UnwindSafe for ModuleView<'a>
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