People who programmed in Perl are probably familiar with what was called slurp mode that was later converted to a function called slurp. The whole idea was to make it easy to read the content of a text file into memory, to slurp it in.
In Rust there is a function called read_to_string that does this.
use std::fs::read_to_string;
fn main() {
let filename = "data.txt";
let content = read_to_string(filename).unwrap();
println!("------");
print!("{}", content);
println!("------");
}
It is nice and easy to use, you just have to remember that this will read the whole file into memory which is not going to work well for huge files.