use std::fs::File;
use std::io::{BufRead};
use anyhow::Result;
use std::time::Instant;
use std::io;
pub fn read_doc_words(file_path: &str, line_to_read: usize) -> Result<Option<String>> {
let file = File::open(file_path)?;
let reader = io::BufReader::new(file);
let start = Instant::now();
for (current_line, line) in reader.lines().enumerate() {
let line = line?; if line.trim().is_empty() {
continue;
}
if current_line == line_to_read {
let duration = start.elapsed();
println!("the : found in : {:?}", duration);
return Ok(Some(line.trim().to_string()));
}
}
Ok(None)
}