pub async fn read_words(file_path: PathBuf) -> Result<HashSet<String>, Box<dyn std::error::Error>> {
    let file = File::open(file_path).await?;
    let reader = BufReader::new(file);
    let mut list = reader.lines();
    let mut words = HashSet::new();
    while let Ok(Some(x)) = list.next_line().await {
        words.insert(x);
    }

    Ok(words)
}
/// Function to read and return a list of words from a file.
/// Each line contains only one word.
/// Used for reading Search Words.
Function to read and return a list of words from a file.
Each line contains only one word.
Used for reading Search Words.
Function to read and return a list of words from a file . Each line contains only one word . Used for reading Search Words .
pub async fn read_words(file_path: PathBuf) -> Result<HashSet<String>, Box<dyn std::error::Error>> {
    let file = File::open(file_path).await?;
    let reader = BufReader::new(file);
    let mut list = reader.lines();
    let mut words = HashSet::new();
    while let Ok(Some(x)) = list.next_line().await {
        words.insert(x);
    }
    Ok(words)
}
pub async fn read_words ( file_path : PathBuf ) -> Result < HashSet < String > , Box < dyn std :: error :: Error > > { let file = File :: open ( file_path ) . await ? ; let reader = BufReader :: new ( file ) ; let mut list = reader . lines ( ) ; let mut words = HashSet :: new ( ) ; while let Ok ( Some ( x ) ) = list . next_line ( ) . await { words . insert ( x ) ; } Ok ( words ) }
Function to read and return a list of words from a file.
Function to read and return a list of words from a file .
file_path
PathBuf
file_path
PathBuf