Module gs1

Module gs1 

Source
Expand description

The type CheckDigitAlgorithm provides an implementation of the check digits specified for GS1 data types.

§Example

use codes_check_digits::{gs1, Calculator};

let calculator = gs1::get_algorithm_instance(gs1::CodeFormat::Gln);
assert!(calculator.is_valid("9436465792104"));
assert!(calculator.validate("9436465792104").is_ok());
assert_eq!(calculator.calculate("943646579210"), Ok(4));

Structs§

CheckDigitAlgorithm
Validate the different identifiers defined by GS1.

Enums§

CodeFormat
This enumeration denotes the type of code to be validated.

Functions§

get_algorithm_instance