use std::fs::File;
use std::io::{BufRead, BufReader};
fn main() {
//要打开的文件名
let filename = "src/main.rs";
//以只读模式打开文件
let file = File::open(filename).unwrap();
let lines = BufReader::new(file).lines();
//遍历所有行
for line in lines{
if let Ok(data) = line {
println!("{}", data);
}
}
}