// parse.rs // // Copyright 2018 Ricardo Silva Veloso // // Licensed under the Apache License, Version 2.0 or the MIT License // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. // // SPDX-License-Identifier: (MIT OR Apache-2.0) use brids::Cpf; fn main() { let mut buf = String::new(); println!("Enter a CPF number:"); while let Ok(2..) = std::io::stdin().read_line(&mut buf) { match buf.trim().parse::() { Ok(cpf) => println!("{cpf} is a valid number."), Err(err) => eprintln!("Error: {err}"), } buf.clear(); } }