4E3RRJMP7UHT5AOC3UGP3KP73TIFJ5CBQHUG3ZXUJS6DFXZ6FB6QC
TK7PTRNM36LREARJCBQQ5T746DUO7SLA2JJTUQ7QFBMVI37UPGQQC
XXAMOGJDGPDKTOUF6DJBHSO3DE3DWX7R4WTCTRVIL6MXPJOXIT3QC
NVOP7TM5M3HLUUPSA3J2CGKR73KBXHGGMUIJOSJ57TPLZ7RDMDVQC
use std::io;
let cfg = read_config("/home/frank/.tn").expect("could not generate config");
if let Ok(cfg) = read_config("/home/frank/.tn") { println!("WORKING"); println!("{:?}", cfg); } else { println!("not working properly"); }
if let Ok(cfg) = read_config("/home/frank/.tn") {
println!("WORKING");
println!("{:?}", cfg);
} else {
println!("not working properly");
}
// other variant would be with functional programming using closures and unwrap_or_else
fn read_config(cfgfile: &str) -> Result<Config, &'static str> {
fn read_config(cfgfile: &str) -> Result<Config, io::Error> { // XXX: read config and potentially retrun io::Error
fn read_config(cfgfile: &str) -> Result<Config, io::Error> {
// XXX: read config and potentially retrun io::Error