Rust 读取文件内容
use std::error::Error;
use std::fs::File;
use std::io::Read;
pub fn read_file(path: &str) -> Result<String, Box<dyn Error>> {
let mut content = String::new();
File::open(path)?.read_to_string(&mut content)?;
return Ok(content);
}
浙公网安备 33010602011771号