|
@@ -14,6 +14,17 @@ struct Dictionary {
|
|
|
iter_position: usize,
|
|
|
}
|
|
|
|
|
|
+impl Dictionary {
|
|
|
+ fn load_from_iterable(
|
|
|
+ &mut self,
|
|
|
+ lines: impl Iterator<Item = Result<String, Error>>,
|
|
|
+ ) -> Result<(), std::io::Error> {
|
|
|
+ lines
|
|
|
+ .map(|line| line.and_then(|line_str| Ok(self.words.push(line_str))))
|
|
|
+ .collect()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/*impl Dictionary {
|
|
|
fn default() -> Dictionary {
|
|
|
Dictionary{words: vec![], iter_position: 0}
|