Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A question on FileSystem example #110

Open
secmask opened this issue Jul 1, 2021 · 0 comments
Open

A question on FileSystem example #110

secmask opened this issue Jul 1, 2021 · 0 comments

Comments

@secmask
Copy link

secmask commented Jul 1, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant