1 2 3 4 5 6 7 8 9
use std::io::Read; use std::{fs, io, str}; pub fn read_file(path: &str) -> io::Result<String> { let mut s = String::new(); fs::File::open(path) .and_then(|mut f| f.read_to_string(&mut s)) .map(|_| s) }