use std::fs; pub mod diagnostics; pub fn char_to_u64(s : char) -> Option { s.to_string().parse::().ok() } pub fn read_from_file(name : &str) -> String { match fs::read_to_string(name) { Err(error) => { println!("Failed to read file {name}: {error}"); String::new() }, Ok(s) => s, } } pub fn str_to_i32(s : &str) -> Option { s.trim().to_string().parse::().ok() } pub fn str_to_u8(s : &str) -> Option { s.trim().to_string().parse::().ok() } pub fn str_to_u32(s : &str) -> Option { s.trim().to_string().parse::().ok() } pub fn str_to_u64(s : &str) -> Option { s.trim().to_string().parse::().ok() }