trivet 3.1.0

The trivet Parser Library
Documentation
use std::io::{self, BufRead};
use trivet::parse_from_string;
use trivet::parsers::datetime::{is_date, is_time, parse_date_time};

fn main() {
    let stdin = io::stdin();
    for line in stdin.lock().lines() {
        match line {
            Err(msg) => {
                println!("Error: {}", msg);
                break;
            }
            Ok(text) => {
                // Test what the line contains.
                let mut parser = parse_from_string(&text);
                parser.consume_ws();
                if is_date(&mut parser) {
                    println!("is_date returns true");
                }
                if is_time(&mut parser) {
                    println!("is_time returns true");
                }
                let datetime = parse_date_time(&mut parser);
                match datetime {
                    Err(msg) => {
                        println!("Error: {}", msg);
                    }
                    Ok(Some(value)) => {
                        println!("{}", value);
                    }
                    Ok(None) => {
                        println!("Entry is not a date or time; ignoring.");
                    }
                }
            }
        }
    }
}