error[E0425]: cannot find value buffer_iter
in this scope
--> src\myfs.rs:42:26
|
42 | println!("{:?}", buffer_iter);
| ^^^^^^^^^^^ not found in this scope
For more information about this error, try rustc --explain E0425
.
error: could not compile my_project
(bin "my_project") due to 1 previous error
pub fn test_read_file(){
let file_path = "./data/file01.txt";
let read_file_result = fs::read(file_path);
if read_file_result.is_ok(){
let buffer = read_file_result.unwrap().iter();
println!("{:?}", buffer_iter);
}
else{
println!("Some problem occured reading files: {:?}", read_file_result.err());
}
}
This version compiler didn't complain.
pub fn test_read_file(){
let file_path = "./data/file01.txt";
let read_file_result = fs::read(file_path);
if read_file_result.is_ok(){
let buffer = read_file_result.unwrap();
let buffer_iter = buffer.iter();
println!("{:?}", buffer_iter);
}
else{
println!("Some problem occured reading files: {:?}", read_file_result.err());
}
}
Why????