This commit is contained in:
steven-omaha
2022-12-02 16:50:04 +01:00
parent c90096b9b6
commit 09f9661625
+3 -3
View File
@@ -1,8 +1,6 @@
use std::collections::HashSet; use std::collections::HashSet;
use std::fmt::{Display, Write}; use std::fmt::{Display, Write};
use std::fs::File;
use std::hash::Hash; use std::hash::Hash;
use std::io::{BufReader, Lines};
#[derive(Debug, Eq, PartialOrd, Ord)] #[derive(Debug, Eq, PartialOrd, Ord)]
pub struct Package { pub struct Package {
@@ -20,7 +18,9 @@ impl From<String> for Package {
} }
impl Package { impl Package {
pub(crate) fn from_lines(lines: Lines<BufReader<File>>) -> HashSet<Self> { pub(crate) fn from_lines(
lines: impl Iterator<Item = Result<String, std::io::Error>>,
) -> HashSet<Self> {
lines lines
.into_iter() .into_iter()
.map(|l| Package::from(l.unwrap())) .map(|l| Package::from(l.unwrap()))