horse/lib.rs
1//! Horse Project
2use std::fs::File;
3use std::io::Read;
4use std::path::Path;
5
6
7/// # Load a horse ascii image from this project to display.
8///
9/// And how to use it ?
10/// ```rust
11/// fn main(){
12/// horse::show();
13/// }
14/// ```
15pub fn show() {
16 let path = Path::new("img.txt");
17
18 let mut file = match File::open(&path) {
19 Err(_why) => panic!("Unreachable Error..."),
20 Ok(file) => file
21 };
22
23 let mut s = String::new();
24 match file.read_to_string(&mut s) {
25 Err(_why) => panic!("Unreachable Error..."),
26 Ok(_) => println!("{}", s),
27 }
28}