Use the std::fs module to read, write, and manage files by calling its functions with a file path and handling the resulting Result.
use std::fs;
fn main() {
let contents = fs::read_to_string("hello.txt")
.expect("Failed to read file");
println!("{contents}");
fs::write("hello.txt", "Hello, world!")
.expect("Failed to write file");
fs::remove_file("hello.txt")
.expect("Failed to remove file");
}