stevedonovan/gentle-intro

A question on FileSystem example

Opened this issue · 0 comments

I would like to thank you for great tutorials, in FileSystem section, I see this example

use std::fs::File;
use std::io;
use std::io::prelude::*;

fn read_all_lines(filename: &str) -> io::Result<()> {
    let file = File::open(&filename)?;

    let reader = io::BufReader::new(file);

    for line in reader.lines() {
        let line = line?;
        println!("{}", line);
    }
    Ok(())
}

this line let file = File::open(&filename)?; , what is meaning of & before filename? as it still compile if I remove it.