pub struct LinearPattern {
pub bars: Vec<u8>,
pub text: Option<String>,
}Expand description
A 1D bar pattern as a run-length encoding.
bars[i] is the width (in modules) of the i-th element. Even indices
(0, 2, 4, …) are bars (foreground), odd indices are spaces (background).
This matches BWIPP’s sbs (start-bar-space) convention.
Fields§
§bars: Vec<u8>Run-length widths, starting with a bar.
text: Option<String>Human-readable text rendered beneath the bars (if the symbology supports it).
Implementations§
Source§impl LinearPattern
impl LinearPattern
Sourcepub fn from_modules(modules: &str, text: Option<String>) -> Self
pub fn from_modules(modules: &str, text: Option<String>) -> Self
Build a LinearPattern from a string of ‘1’ and ‘0’ characters where
‘1’ is a bar module and ‘0’ is a space module.
Sourcepub fn total_width(&self) -> u32
pub fn total_width(&self) -> u32
Total width in modules (sum of all bar/space widths).
Trait Implementations§
Source§impl Clone for LinearPattern
impl Clone for LinearPattern
Source§fn clone(&self) -> LinearPattern
fn clone(&self) -> LinearPattern
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 moreAuto Trait Implementations§
impl Freeze for LinearPattern
impl RefUnwindSafe for LinearPattern
impl Send for LinearPattern
impl Sync for LinearPattern
impl Unpin for LinearPattern
impl UnsafeUnpin for LinearPattern
impl UnwindSafe for LinearPattern
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