use std::fs;
fn main() {
let data = fs::read_to_string("file_name.txt").expect("Unable to read file");
println!("{}", data);
}
use std::fs::File;
fn main() -> std::io::Result<()> {
let mut f = File::open("foo.txt")?;
Ok(())
}
use std::fs;
fn main() {
let content = match fs::read_to_string("Cargo.toml") {
Result::Ok(value) => value,
Result::Err(error) => panic!("{}", error)
};
println!("{}", content)
}