use std::path::Path; use std::fs::File; use std::io::{BufRead, BufReader}; use fqdn::FQDN; use fqdn_trie::FqdnTrieSet; fn main() { // Create a path to the desired file let path = Path::new("/Users/xophe/Logiciels/TESS/Antidote/mudkeys"); // Open the path in read-only mode, returns `io::Result` let file = File::open(&path).unwrap(); let reader = BufReader::new(file); let mut trie = FqdnTrieSet::new(FQDN::default()); reader.lines() .take(999) .for_each(|line| if let Ok(s) = line { if let Ok(fqdn) = s.parse() { trie.insert(fqdn); } } ); }