面试题答案
一键面试use std::fs::File;
use std::io::{self, Read};
fn read_file_to_string(file_path: &str) -> Result<String, io::Error> {
let mut file = File::open(file_path)?;
let mut contents = String::new();
file.read_to_string(&mut contents)?;
Ok(contents)
}