If you need to read a file in Rust, then you can use the fs package from the standard library:

1
2
3
4
5
6
7
8
use std::fs;

fn main() {
    let contents = fs::read_to_string(filename)
        .expect("Something went wrong reading the file");

    println!("With text:\n{}", contents);
}