Clean up day 13 a little.

This commit is contained in:
2021-12-13 08:52:57 +01:00
parent d471f170b3
commit ffe8d27469
2 changed files with 51 additions and 31 deletions

View File

@@ -53,7 +53,7 @@ impl<'a, I: FromStr> LineParser<'a, I> {
}
}
impl<'a, I: FromStr> Iterator for LineParser<'a, I> {
impl<I: FromStr> Iterator for LineParser<'_, I> {
type Item = I;
fn next(&mut self) -> Option<Self::Item> {
@@ -61,6 +61,15 @@ impl<'a, I: FromStr> Iterator for LineParser<'a, I> {
}
}
impl<'a, I: FromStr> From<LineIter<'a>> for LineParser<'a, I> {
fn from(iter: LineIter<'a>) -> Self {
Self {
iter,
_data: PhantomData,
}
}
}
/// Return two arguments in their natural PartialOrd order
pub fn ordered<O: PartialOrd>(a: O, b: O) -> (O, O) {
if a < b {