validate_gtin

Function validate_gtin 

Source
pub fn validate_gtin(code: &str) -> Option<&'static str>
Examples found in repository?
examples/gtin_validated_debug.rs (line 12)
6async fn main() {
7    let mut stream = ScannerStream::new().unwrap();
8    println!("Listening... scan something:");
9
10    while let Some(ev) = stream.next().await {
11        if let Some(text) = ev.text.clone() {
12            match validate_gtin(&text) {
13                Some(gtin_type) => {
14                    println!("{} is a valid {}", text, gtin_type);
15                },
16                None => {
17                    println!("{} is NOT a valid GTIN", text);
18                },
19            }
20        }
21    }
22}