Struct Barcode
pub struct Barcode { /* private fields */ }Expand description
A validated EAN-13 or EAN-8 (JAN) code.
Implementations§
§impl Barcode
impl Barcode
pub fn parse(text: &str) -> Result<Barcode, BarcodeError>
pub fn parse(text: &str) -> Result<Barcode, BarcodeError>
Parse and validate a 13- or 8-digit code. Spaces and hyphens are skipped (cards print the digits in groups).
§Errors
BarcodeError for an empty string, a non-digit character, a digit
count other than 13 or 8, or a wrong check digit.
Trait Implementations§
impl Copy for Barcode
impl Eq for Barcode
impl StructuralPartialEq for Barcode
Auto Trait Implementations§
impl Freeze for Barcode
impl RefUnwindSafe for Barcode
impl Send for Barcode
impl Sync for Barcode
impl Unpin for Barcode
impl UnsafeUnpin for Barcode
impl UnwindSafe for Barcode
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