mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-26 05:10:32 +01:00
Implement day 5
Nom is really nice and fast, why did I write parsers manually before.
This commit is contained in:
@@ -60,3 +60,12 @@ impl<'a, I: FromStr> Iterator for LineParser<'a, I> {
|
||||
self.iter.next()?.parse().ok()
|
||||
}
|
||||
}
|
||||
|
||||
/// Return two arguments in their natural PartialOrd order
|
||||
pub fn ordered<O: PartialOrd>(a: O, b: O) -> (O, O) {
|
||||
if a < b {
|
||||
(a, b)
|
||||
} else {
|
||||
(b, a)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user