You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
I would like to thank you for great tutorials, in FileSystem section, I see this example
this line
let file = File::open(&filename)?;
, what is meaning of&
before filename? as it still compile if I remove it.The text was updated successfully, but these errors were encountered: