1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
//! Horse Project use std::fs::File; use std::io::Read; use std::path::Path; /// # Load a horse ascii image from this project to display. /// /// And how to use it ? /// ```rust /// fn main(){ /// horse::show(); /// } /// ``` 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), } }