1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
use std::fs::File; use std::io::Read; use std::path::Path; pub fn show() { let path = Path::new("img.txt"); let mut file = match File::open(&path) { Err(_why) => panic!("Unreachable Error..."), Ok(file) => file }; let mut s = String::new(); match file.read_to_string(&mut s) { Err(_why) => panic!("Unreachable Error..."), Ok(_) => println!("{}", s), } }