diff options
| author | 2024-12-02 14:39:59 +0100 | |
|---|---|---|
| committer | 2024-12-02 14:39:59 +0100 | |
| commit | f40672059393040e9403ba3c1ec442d0823d1622 (patch) | |
| tree | 6c69a745f4e541871af8111090f830b490c4fe70 /aoc | |
| parent | 06798655809d7fca51710c04ba5ad435d614ef96 (diff) | |
| download | 2024-f40672059393040e9403ba3c1ec442d0823d1622.tar.gz 2024-f40672059393040e9403ba3c1ec442d0823d1622.tar.bz2 2024-f40672059393040e9403ba3c1ec442d0823d1622.zip | |
Day2
Diffstat (limited to 'aoc')
| -rw-r--r-- | aoc/src/lib.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/aoc/src/lib.rs b/aoc/src/lib.rs index 5fad72d..c4318e1 100644 --- a/aoc/src/lib.rs +++ b/aoc/src/lib.rs | |||
| @@ -2,6 +2,7 @@ use clap::Parser; | |||
| 2 | use std::fs::File; | 2 | use std::fs::File; |
| 3 | use std::io; | 3 | use std::io; |
| 4 | use std::io::{BufRead, BufReader, Read}; | 4 | use std::io::{BufRead, BufReader, Read}; |
| 5 | use std::time::Instant; | ||
| 5 | 6 | ||
| 6 | #[derive(Parser, Debug)] | 7 | #[derive(Parser, Debug)] |
| 7 | #[command(version, about, long_about = None)] | 8 | #[command(version, about, long_about = None)] |
| @@ -47,13 +48,17 @@ pub fn main(day: &dyn Day) { | |||
| 47 | let buffer = BufReader::new(reader); | 48 | let buffer = BufReader::new(reader); |
| 48 | 49 | ||
| 49 | let result: String; | 50 | let result: String; |
| 51 | |||
| 52 | let now = Instant::now(); | ||
| 53 | |||
| 50 | if args.part == 1 { | 54 | if args.part == 1 { |
| 51 | result = day.part_1(buffer); | 55 | result = day.part_1(buffer); |
| 52 | } else { | 56 | } else { |
| 53 | result = day.part_2(buffer); | 57 | result = day.part_2(buffer); |
| 54 | } | 58 | } |
| 55 | 59 | ||
| 56 | println!("Result: {result}") | 60 | println!("Result: {result}"); |
| 61 | println!("Time to run: {}s", now.elapsed().as_secs_f64()); | ||
| 57 | } | 62 | } |
| 58 | 63 | ||
| 59 | pub fn test_day<T: Day>(day: &T) { | 64 | pub fn test_day<T: Day>(day: &T) { |
