Adds Day1

This commit is contained in:
2024-12-01 20:55:15 +01:00
parent a2d898e66b
commit d3bd96f14f
9 changed files with 1205 additions and 4 deletions

28
src/error/mod.rs Normal file
View File

@@ -0,0 +1,28 @@
use std::{num::{ParseIntError, TryFromIntError}, convert::Infallible, io};
#[derive(Debug)]
pub struct AdventError(pub String);
impl From<ParseIntError> for AdventError {
fn from(e: ParseIntError) -> Self {
AdventError(e.to_string())
}
}
impl From<io::Error> for AdventError {
fn from(e: io::Error) -> Self {
AdventError(e.to_string())
}
}
impl From<Infallible> for AdventError {
fn from(_: Infallible) -> Self {
unreachable!()
}
}
impl From<TryFromIntError> for AdventError {
fn from(e: TryFromIntError) -> Self {
AdventError(e.to_string())
}
}