Compare commits

...

2 Commits

Author SHA1 Message Date
8ae82163b4
Add day03 boilerplate 2022-12-02 07:53:41 +01:00
5a02a5bbe9
Fix from trait 2022-12-02 07:53:27 +01:00
3 changed files with 28 additions and 1 deletions

View File

@ -7,7 +7,7 @@ struct Hand {
impl From<&str> for Hand { impl From<&str> for Hand {
fn from(s: &str) -> Self { fn from(s: &str) -> Self {
Self { letter: s.0.chars().next().unwrap() } Self { letter: s.chars().next().unwrap() }
} }
} }

23
src/day03/mod.rs Normal file
View File

@ -0,0 +1,23 @@
use crate::read;
pub fn run() {
let input = read("02");
let lines = input
.lines()
.map(|l| {
l
});
#[cfg(feature = "part1")]
{
let a = "TODO";
eprintln!("Day 2, Part 01: {}", a);
}
#[cfg(feature = "part2")]
{
let b = "TODO";
eprintln!("Day 2, Part 02: {}", b);
}
}

View File

@ -3,6 +3,7 @@ use std::path::Path;
use std::time::Instant; use std::time::Instant;
mod day01; mod day01;
mod day02; mod day02;
mod day03;
fn main() { fn main() {
let today = Local::now().day(); let today = Local::now().day();
@ -13,6 +14,9 @@ fn main() {
if cfg!(feature = "day02") || (cfg!(feature = "today") && today == 2) { if cfg!(feature = "day02") || (cfg!(feature = "today") && today == 2) {
day02::run(); day02::run();
} }
if cfg!(feature = "day03") || (cfg!(feature = "today") && today == 3) {
day03::run();
}
println!("Finished, time taken: {:?}", now.elapsed()) println!("Finished, time taken: {:?}", now.elapsed())
} }